Instalando o Virtual Frame Buffer no Linux: Difference between revisions
No edit summary |
No edit summary |
||
Line 25: | Line 25: | ||
You will see many lines of output. At the ">" prompt, run the capabilities() command. It will tell you whether the X11, JPEG and PNG devices are functioning. The following example output shows success: | You will see many lines of output. At the ">" prompt, run the capabilities() command. It will tell you whether the X11, JPEG and PNG devices are functioning. The following example output shows success: | ||
> capabilities() | > capabilities() | ||
jpeg png tcltk X11 http/ftp sockets libxml fifo | jpeg png tcltk X11 http/ftp sockets libxml fifo | ||
TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE | TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE |
Latest revision as of 16:44, 23 July 2024
Instalando os pacotes Necessários
Instale os seguintes pacotes ao seu linux:
- xorg-x11-server-Xorg - xorg-x11-server-Xvfb
se você estiver utilizando o yum faça o seguinte:
yum -y install xorg-x11-server-Xorg xorg-x11-server-Xvfb
Start and Test Xvfb
To start Xvfb, use the following command:
/usr/bin/Xvfb :2 -nolisten tcp -shmem
This starts a Display on servernumber = 2 and screen number = 0.
To test whether the X11, PNG and JPEG devices are available in R:
export DISPLAY=:2.0
You will see many lines of output. At the ">" prompt, run the capabilities() command. It will tell you whether the X11, JPEG and PNG devices are functioning. The following example output shows success:
> capabilities() jpeg png tcltk X11 http/ftp sockets libxml fifo TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE cledit iconv NLS profmem TRUE TRUE TRUE FALSE
Make configuration changes to ensure that Xvfb is started at boot-time You need to make sure that Xvfb runs at all times on the machine or R will not function as needed. There are many ways to do this. This example uses a simple start/stop script and treats it as a service.
The script:
cd /etc/init.d vi xvfb
#!/bin/bash # # /etc/rc.d/init.d/xvfb # # Author: Brian Connolly (LabKey.org) # # chkconfig: 345 98 90 # description: Starts Virtual Framebuffer process to enable the # LabKey server to use R. # # XVFB_OUTPUT=/usr/local/labkey/Xvfb.out XVFB=/usr/bin/Xvfb XVFB_OPTIONS=":2 -nolisten tcp -shmem" # Source function library. . /etc/init.d/functions start() { echo -n "Starting : X Virtual Frame Buffer " $XVFB $XVFB_OPTIONS >>$XVFB_OUTPUT 2>&1& RETVAL=$? echo return $RETVAL } stop() { echo -n "Shutting down : X Virtual Frame Buffer" echo killproc Xvfb echo return 0 } case "$1" in start) start ;; stop) stop ;; *) echo "Usage: xvfb {start|stop}" exit 1 ;; esac exit $?
Now test the script with the standard:
/etc/init.d/xvfb start /etc/init.d/xvfb stop /etc/init.d/xvfb
This should work without a hitch.
Note: Any error messages produced by Xvfb will be sent to the file set in
$XVFB_OUTPUT.
If you experience problems, these messages can provide further guidance.
The last thing to do is to run chkconfig to finish off the configuration. This creates the appropriate start and kills links in the rc#.d directories. The script above contains a line in the header comments that says "# chkconfig: 345 98 90". This tells the chkconfig tool that xvfb script should be executed at runlevels 3,4,5. It also specifies the start and stop priority (98 for start and 90 for stop). You should change these appropriately.
chkconfig --add xvfb
Check the results:
chkconfig --list xvfb ... xvfb 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Verify that the appropriate soft links have been created:
ls -la /etc/rc5.d/ | grep xvfb ... lrwxrwxrwx 1 root root 14 2008-01-22 18:05 S98xvfb -> ../init.d/xvfb
Start the Xvfb Process and Setup the DISPLAY Env Variable
Start the process using:
/etc/init.d/xvfb start
Now you will need to the set the DISPLAY env variable for the user. This is the DISPLAY variable that is used to run the TOMCAT server. Add the following the .bash_profile for this user. On this serer, the TOMCAT process is run by the user tomcat
vi ~tomcat/.bash_profile
# Set DISPLAY variable for using LabKey and R. DISPLAY=:2.0 export DISPLAY
Restart the LabKey Server or it will not have the DISPLAY variable set
On this server, we have created a start/stop script for TOMCAT within /etc/init.d. So I will use that to start and stop the server