Start XAMPP at boot – Ubuntu way

Posted: 15 Mei 2011 in linux

I Installed XAMPP inside Ubuntu 10.04 in My PC. Using this XAMPP, i create a blog to manage all note & tips my work that can’t be posted in public because of proprietary reason. I need to start XAMPP service automatically at start up of the PC. So, here i go.

( I installed XAMPP in /opt . Full path of lampp binary is /opt/lampp/lampp )

1. Create an init script in /etc/init.d/

cd /etc/init.d/
sudo vi lampp
copy and paste this lines:
#!/bin/bash
/opt/lampp/lampp start

2. Use update-rc.d to install init scripts to all runlevel.

sudo update-rc.d lampp defaults

In the next restart, XAMPP will automatically started. We can verify using this command.

user@jeos$ ps -ef | grep lampp
root 3842 1 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
root 3869 1 0 20:42 ? 00:00:00 /bin/sh /opt/lampp/bin/mysqld_safe –datadir=/opt/lampp/var/mysql –pid-file=/opt/lampp/var/mysql/jeos.pid
nobody 3903 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3923 3869 0 20:42 ? 00:00:01 /opt/lampp/sbin/mysqld –basedir=/opt/lampp –datadir=/opt/lampp/var/mysql –user=nobody –pid-file=/opt/lampp/var/mysql/jeos.pid –skip-external-locking –port=3306 –socket=/opt/lampp/var/mysql/mysql.sock
nobody 3929 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3930 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3931 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3932 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3933 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody 3957 3842 0 20:42 ? 00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5

we can enhanced the startup script to accept argument like start, stop, restart.

source article : disini

The post is brought to you by lekhonee v0.7

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s