Have Your Own (Chrooted) Debian LAMP Server While Running The Perfect Ubuntu Desktop
|
Submitted by the_g_bomb (Contact Author) (Forums) on Mon, 2007-10-22 12:05. :: Debian | Ubuntu | Apache | MySQL | PHP
Have Your Own (Chrooted) Debian LAMP Server While Running The Perfect Ubuntu DesktopThis is a brief description about the steps to be taken to setup a Debian based Webserver (Debian Sarge alias Debian 3.1) that will run chrooted under Ubuntu 7.04. I have followed Falkos excellent how to guide on setting up the perfect ubuntu 7.04 desktop: http://www.howtoforge.com/the_perfect_desktop_ubuntu7.04 However to make the desktop perfect for me I need to add one or two things. Firstly I will add AVG as I may be taking files and data to and other PC's and so I want to make sure I'm not passing on viruses, To do this I will follow another of Falkos excellent guides: http://www.howtoforge.com/avg_antivirus_ubuntu_feisty Then I need to install a web server that resembles my ISPs so that I can test before I upload them to their final resting place. I'm not running my own webserver because I connect to the net via ADSL, it may be up to 8M download, but it only gets 256K upload, which is what visitors to my sites will get and that will depend on the traffic at my local exchange. I want my webpages to get the full benefit of the bandwidth available to my ISP's T1 connection, so I'm keeping my webpages hosted remotely. This doesn't mean that I can't test everything thoroughly before it goes there and so I need my LAMP server to include:
These older versions of Apache, PHP and mysql are no longer available for installation under Ubuntu and can be only installed on debian Sarge, so instead of running this as my base platform I will install it as a minimal system on top of my Ubuntu Desktop and run the Debian programs through chroot. If you're doing this too and have installed apache or mysql already then you will need to make sure that they are not running while you are installing or running your sarge apache/mysql. This is because the sarge apache and mysql will fail to bind to their respective listen ports if the ubuntu versions are already listening to them. First we have to install debootstrap as we will be using it to create the minimal system. Then we can download and install Debian Sarge. Open a Terminal window: sudo bash Now you should find your nearest debian mirror and use it to download and install the debian system. Go to http://www.debian.org/mirror/list/ and find the appropriate mirror address, then: debootstrap sarge sarge-dir http://ftp.uk.debian.org/debian I'm using the UK's mirror but you can change the uk part to whatever you need. After a few minutes the download and install should have completed, you need to: mount -o bind /proc sarge-dir/proc This will make proc filesystem available in chroot. The Proc psuedo file system is a real time, memory resident file system that tracks the processes running on your machine and the state of your system. And from now on using the new system is a simple as typing: chroot sarge-dir This command puts you into chroot and you can modify files inside the newly installed sarge system. At this point if you wish you could follow another of Falkos excellent howto guides: http://www.howtoforge.com/perfect_setup_debian_sarge Just start the tutorial after the networking section. Although some extra work will be needed to get the mail server installed properly as in that tutorial it is installed during startup, but that is for someone else to provide details of. I'm not going to do that as I need a different version of apache and I don't need all the other stuff setup. So I'm going to edit the sources.list and update the file system. echo deb http://ftp.uk.debian.org/debian/ sarge main > /etc/apt/sources.list Now its time to install the programs that I need: apt-get install apache php4 mysql-server phpmyadmin Enable suExec? <-- Yes You may find some error messages flash up regarding the locales not being configured:
perl: warning: Setting locale failed. This could be because the debootstrap method of installation may not have installed the locales. apt-get install locales localeconf
Select locales to be generated. I will now create a sarge user that is the same as my current ubuntu one. This means that I shouldn't have any issues with permissions when I edit my webpages in Ubuntu. adduser user_name_in_ubuntu The Apache configuration file is still located at: /etc/apache/httpd.conf, but it is referenced from the sarge-dir and the same thing applies to your web folder /var/www. When editing webpages from the Ubuntu Desktop go to the sarge-dir first then find /var/www/. When editing webpages in Ubuntu go to the sarge-dir first then find /var/www/ Now I will check the installations. The apache and php installs can be done together by creating a phpinfo file in your /var/www folder with the phpinfo() command in it. Still chrooted for the moment. nano /var/www/phpinfo.php In this file you should type: <?php Point your browser to http://localhost/phpinfo.php and this should show the entire apache configuration and default settings. The configuration file for mysql is located at: /etc/mysql/my.cnf again referenced from the sarge-dir. At this point it's also worth setting the Root password so, still chrooted: mysql -u root To get you to the mysql command prompt, then: mysql> USE mysql; The phpmyadmin configuration file is located at: /etc/phpmyadmin/config.inc.php. You may want to add your mysql password into it to save you logging into the phpmyadmin console each time you need to use it. If you ever need to restart Apache or if apache doesn't start on startup, then you'll need to chroot into sarge first and then restart apache. sudo bash
|



Recent comments
17 hours 23 min ago
22 hours 22 min ago
23 hours 48 min ago
1 day 41 min ago
1 day 2 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 9 hours ago
1 day 23 hours ago
2 days 38 min ago