Build a virtual machine with phpdaemon on Ubuntu 10.10
Good afternoon, to all readers of Habra. I would like to tell all of you a very simple and quick way to assemble a virtual game with a php demon and at the same time not to overstrain your resting and celebrating brain. Often, Windows is installed on work or home computers for one reason or another, religious or political. Putting php or nginx on it is a thankless task, and if there is a need to work with phpdaemon then there are no options at all. A nix system is required.
This article does not address the issues of why I chose Ubuntu and not Debian, why use phpdaemon and not php-fpm, etc. It is possible that someone will have to face a similar problem, and if this article allows you to save valuable time and spend it with your family or at work, then my task has been completed successfully.
- 1. We put VirtualBox on our system, I think no one will have problems here ( download here ).
- 2. Download a fresh image of Ubuntu ( select here )
- 3. In VirtualBox we create a virtual machine for Ubuntu and put the system there
So, the initial stage is completed, by this moment we should have VirtualBox on the computer with the Ubuntu 10.10 virtual machine.
Ubuntu small tuning
I don’t need Gnome at work, so you can disable the graphical shell of Ubuntu so that it does not eat the resources of our computer. Surely there are many ways to do this, I used this:
sudo nano /etc/init/gdm.conf
Next, comment on the lines CTRL + O will save the changes to the file. CTRL + X will exit it. After rebooting the virtual machine, the Dwarf will not start. But if you want, you can start it with the startx command . The next step is to set a root password in order not to use sudo every time.
#start on (filesystem
# and started hal
# and tty-device-added KERNEL=tty7
# and (graphics-device-added or stopped udevtrigger))
sudo passwd root
We put phpdaemon
Install php, libevent and pear: Now you need to install 2 pecl extensions. They refuse to be put on teams, referring to the lack of stable versions. Therefore, just copy the link that they themselves will offer instead of the name of the package. We put Git, it will be needed to draw fresh rankit and phpdemona. Pull, set and knock runkit. Now we will configure php: Note that libevent.so and proctitle.so will lie where they cannot be found automatically, so you have to specify the full path to the files. Now it remains only to install phpdaemon itself: Simlink was created solely for convenience. Well, there remains a small detail - set the right to execute. Now you can try to start the daemon.
apt-get install php5-cli php5-dev
apt-get install libevent-dev
apt-get install php-pear
pecl install libevent (pecl install channel://....)
pecl install proctitle (pecl install channel://....)
apt-get install git-core
git clone git://github.com/zenovich/runkit.git
./configure --enable-runkit --enable-modify
git clone git://github.com/kakserpom/phpdaemon.git
ln -s /opt/phpdaemon/bin/phpdaemon /usr/bin/phpd
chmod +x /opt/phpdaemon/bin/phpdaemon
The daemon will say something like [PHPD] FastCGI up . This means that you have not missed a single line and have followed all the instructions with accuracy. My congratulations.
There are no boundaries for perfection
It is not very convenient to work in such a configuration; I prefer to communicate with servers, albeit virtual ones, via putty. For this purpose, you need to share the virtual machine on the network. The easiest way to do this:
Go to the network adapters of our virtual machine and change the type of connection to the network bridge with our real network card. Thus, Virtualalka will receive an IP address from your dhcp server and you can access it using a very real ip address.
You can see what address was given to the virtual machine by the command:
In order to access the virtual machine via ssh, do not forget to install openssh-server:
apt-get install openssh-server