INSTALL INSTRUCTIONS FOR GENTOO LINUX ------------------------------------- ** INTRODUCTION: The service binary (cdkrest.jar) is installed under /usr/local/cdkrest. This setup runs the service and Xvfb under a dedicated, unpriviledged service account (cdkrest). It uses a boot script for startup and an minimal X-server installation (custom ebuild). ** USER ACCOUNT: The CDK REST service should run under an unpriviledged user account without login permissions: root@ws1 # useradd -d /usr/local/cdkrest -N -r -s /sbin/nologin cdkrest The directory (/usr/local/cdkrest) where CDK REST is installed might need to be owned by cdkrest: root@ws1 # chown cdkrest /usr/local/cdkrest ** THE BOOT SCRIPT: root@ws1 # cat /etc/init.d/cdkrest #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.rc,v 1.23 2007/02/23 11:26:26 uberlord Exp $ depend() { need net } set_env_vars() { JAVA_HOME=`java-config --jre-home` JAVA_OPTS="-Djava.net.preferIPv4Stack=true -jar /usr/local/cdkrest/cdkrest.jar" CDKREST_OPTS="-p 8182 -s 192.168.6.32 -l /var/log/cdkrest.log" XVFB_OPTS=":2 -screen 1 800x600x16" } start() { set_env_vars ebegin "Starting cdkrest" for f in /var/run/cdkrest.pid /var/run/cdkrest.x11 \ /var/log/cdkrest.log /var/log/cdkrest.log.lck; do if ! [ -e $f ]; then touch $f chown cdkrest $f fi done # Start up an virtual X-server (frame buffer): start-stop-daemon --start --exec /usr/bin/Xvfb \ --make-pid --pidfile /var/run/cdkrest.x11 \ --background --chuid cdkrest \ -- ${XVFB_OPTS} export DISPLAY=:2.1 # Start CDK REST service: start-stop-daemon --start --exec ${JAVA_HOME}/bin/java \ --make-pid --pidfile /var/run/cdkrest.pid \ --background --chuid cdkrest \ -- ${JAVA_OPTS} ${CDKREST_OPTS} eend $? "Failed to start cdkrest" } stop() { set_env_vars ebegin "Stopping cdkrest" start-stop-daemon --stop \ --pidfile /var/run/cdkrest.pid \ --exec ${JAVA_HOME}/bin/java start-stop-daemon --stop \ --pidfile /var/run/cdkrest.x11 \ --exec /usr/bin/Xvfb eend $? "Failed to stop cdkrest" } Set the service to start automatic: root@ws1 # rc-update add cdkrest default ** VIRTUAL X SERVER (FRAME BUFFER): Create a custom x11-base/xorg-server ebuild for installing an Xorg server with only Xvfb. Add the ebuild to an local portage overlay (under /usr/local/portage). Apply the diff to a copy of xorg-server-1.5.3-r6.ebuild. Make sure to also copy the files directory from /usr/portage/x11-base/xorg-server to portage overlay. root@ws1 # diff -Naur /usr/portage/x11-base/xorg-server/xorg-server-1.5.3-r6.ebuild /usr/local/portage/x11-base/xorg-server/xorg-server-1.5.3-r8.ebuild --- /usr/portage/x11-base/xorg-server/xorg-server-1.5.3-r6.ebuild 2009-07-13 13:07:33.000000000 +0200 +++ /usr/local/portage/x11-base/xorg-server/xorg-server-1.5.3-r8.ebuild 2009-07-31 12:12:39.000000000 +0200 @@ -86,7 +86,7 @@ video_cards_xgi video_cards_fglrx video_cards_nvidia" -IUSE_SERVERS="dmx kdrive xorg" +IUSE_SERVERS="dmx kdrive xorg xvfb" IUSE="${IUSE_VIDEO_CARDS} ${IUSE_INPUT_DEVICES} ${IUSE_SERVERS} @@ -285,7 +285,7 @@ $(use_enable kdrive) $(use_enable tslib) $(use_enable tslib xcalibrate) - $(use_enable !minimal xvfb) + $(use_enable xvfb) $(use_enable !minimal xnest) $(use_enable !minimal xtrap) $(use_enable !minimal record) Generate the manifest and MD5: root@ws1 # ebuild xorg-server-1.5.3-r8.ebuild digest The server don't need a real graphic card, keyboard or mouse. Just build the dummy drivers: root@ws1 # echo INPUT_DEVICES="void" >> /etc/make.conf root@ws1 # echo VIDEO_CARDS="dummy" >> /etc/make.conf Tell portage to use the local overlay: root@ws1 # echo PORTDIR_OVERLAY="/usr/local/portage" >> /etc/make.conf Check that the ebuild for x11-base/xorg-server will be our custom: root@ws1 # emerge -pv x11-base/xorg-server These are the packages that would be merged, in order: Calculating dependencies... done! ... [ebuild R ] x11-base/xorg-server-1.5.3-r8 USE="ipv6 minimal nptl xvfb (-3dfx) -debug -dmx -hal -kdrive -sdl -tslib -xorg" INPUT_DEVICES="void -acecad -aiptek -citron -elographics -evdev -fpit -hyperpen -joystick -keyboard -mouse -mutouch -penmount -synaptics -tslib (-virtualbox) -vmmouse -wacom" VIDEO_CARDS="dummy -apm -ark -ast -chips -cirrus -epson -fbdev -fglrx (-geode) -glint -i128 (-i740) (-impact) (-imstt) -intel -mach64 -mga -neomagic (-newport) -nv (-nvidia) -r128 -radeon -radeonhd -rendition -s3 -s3virge -savage -siliconmotion -sis -sisusb (-sunbw2) (-suncg14) (-suncg3) (-suncg6) (-sunffb) (-sunleo) (-suntcx) -tdfx -tga -trident -tseng -v4l (-vermilion) -vesa (-via) (-virtualbox) -vmware -voodoo (-xgi)" 0 kB [?=>1] Total: 1 package (1 reinstall), Size of downloads: 0 kB Portage tree and overlays: [0] /usr/portage [1] /usr/local/portage [?] indicates that the source repository could not be determined Emerge the X-server including the required ebuilds (about 60 packages): root@ws1 # emerge x11-base/xorg-server root@ws1 # emerge media-fonts/font-misc-misc media-fonts/font-bitstream-100dpi root@ws1 # emerge media-fonts/font-cursor-misc root@ws1 # emerge x11-libs/libXtst ** START/CHECK THE CDK REST SERVICE: root@ws1 # /etc/init.d/cdkrest start Check that the service and X-server started and runs under the cdkrest service account: root@ws1 # ps -ef | grep ^cdkrest cdkrest 29846 1 0 13:00 ? 00:00:00 /usr/bin/Xvfb :2 -screen 1 800x600x16 cdkrest 29855 1 0 13:00 ? 00:00:04 /opt/sun-jdk-1.6.0.11/bin/java -Djava.net.preferIPv4Stack=true -jar /usr/local/cdkrest/cdkrest.jar -p 8182 -s 192.168.6.32 -l /var/log/cdkrest.log Check that the service binds to external insterface and is using the correct socket family: root@ws1 # netstat -lnp | grep 8182 tcp 0 0 192.168.6.32:8182 0.0.0.0:* LISTEN 3135/java // Anders Lövgren, 2009-08-03