Install LAMP in Gentoo/Sabayon
LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform that uses Linux as operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.
In this post we will see how to install LAMP in Sabayon and Gentoo
1- First Update your System
2- Install Apache Webserver
Download and install
sabayon6 ~ # emerge apache
* IMPORTANT: 3 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.
Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Starting parallel fetch
>>> Emerging (1 of 2) app-admin/apache-tools-2.2.17
* waiting for lock on /usr/portage/distfiles/.httpd-2.2.17.tar.bz2.portage_lockfile
... [ ok ]
The directory of ROOT is in /var/www/localhost/htdocs/
In case you want to allow the users to have their own webpages (public_html), then do:
echo "www-servers/apache userdir" >> /etc/portage/package.use emerge apache
After that you also need to edit the file /etc/conf.d/apache2 and add "-D USERDIR" to APACHE2_OPTS as shown:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D USERDIR"
Then every user have to make a public_html directory in order to put his/her index.html and any other files in there.
If you want to allow just some users to have their own web pages, then you have to edit the userdir module in:
and add to it the following lines:
Code: add to 00_mod_userdir.conf
UserDir enabled user1 user2 root
Now you should check that you can start apache up on your box – to do this run
sabayon6 ~ # /etc/init.d/apache2 start
* Caching service dependencies … [ ok ]
* Starting apache2 …
apache2: Could not reliably determine the server’s fully qualified domain name, using 10.0.2.15 for ServerName [ ok
Add apache2 to the startup script
# rc-update -v add apache2 default
you will see the following response:
* apache2 added to runlevel default
* Caching service dependencies... [ ok ]
* rc-update complete.
3- Install the PHP packages
Install php packages and some other dependencies
# emerge php mod_php
After installing mod_php there are some instructions for some /etc/conf.d/apache2 configuration changes that won’t be made using etc-update, and must be done manually:
* The INI file for this build is /etc/php/apache2-php5/php.ini
* Due to some previous bloopers with PHP and slotting, you may have
* multiple instances of mod_php installed. Please look at the autoclean
* To have Apache run php programs, please do the following:
* Edit /etc/conf.d/apache2 and add “-D PHP5″ to APACHE2_OPTS
APACHE2_OPTS=”-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D PHP5″
Check the PHP install
Now the php packages installed, give small try to check the php page info
Make a file with the script bellow on root directory of apache (example info.php)
< ? phpinfo() ? >
echo '<html><body><?php phpinfo(); ?></body></html>' > /var/www/localhost/htdocs/index.php
Now open the page http://IP/info.php
4- Install MySQL Database
Install the MySql dameon with emerge:
# emerge mysql
Configure MySQL Database
(Replace [version] with the version number you have just installed.) # emerge --config =dev-db/mysql-[version] * MySQL DATADIR is /var/lib/mysql * Press ENTER to create the mysql database and set proper * permissions on it, or Control-C to abort now... Preparing db table Preparing host table Preparing user table Preparing func table Preparing tables_priv table Preparing columns_priv table Installing all prepared tables
This will install the mysql database and instruct you on how to set a password for the MySQL root user (a very good idea if this box is accessible from outside your network). Here is how that is done:
/etc/init.d/mysql start (you have to start the server first!)
usr/bin/mysqladmin -u root -h [your hostname] password ‘new-password’
The following line is not exactly as they instructed. I added the -p flag as I just set a password in the previous line so you need to use your new password to change this.
/usr/bin/mysqladmin -u root -p password ‘new-password’
Test MySQL Server
I start by restarting the MySQL server:
# /etc/init.d/mysql restart
Log in as root (mysql root user, but doesn’t have to be from the Linux root account)
# mysql -u root -p
Check that the database was created correctly, view tables and some data, exit.
mysql> use mysql
mysql> show tables;
mysql> select * from user;
You should have no errors and see a few lines from the select on the user database.
Add MySQL to the startup script
This step is optional, but if you want MySQL to be running automatically upon reboot – a good idea for a web or db server, you should run this command.
# rc-update -v add mysql default
If it worked you will see the following response:
* mysql added to runlevel default
* Caching service dependencies… [ ok ]
* rc-update complete.
5- Install phpMyAdmin
emerge -av phpmyadmin
You’ll need to grant some rights for it to let it do its magic.
mysql -u root -p < /usr/share/webapps/phpmyadmin/<VERSION>/sqlscripts/mysql/<VERSION>_create.sql
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX : Wow! Early last week it was all over the internet, if you haven't heard it yet then this is the t...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Grive: An Unofficial, Open Source Linux Client For Google Drive : A couple of months before, we have featured a Linux client for Google Drive named Syncdrive, which w...0 comments |
- Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubuntu 13.10 : Updated January 12, 2014 LAMP is a combination of operating system and open-source software stack. ...0 comments |
- DNS Server Installation Step by Step Using CentOS 6.5/6.4/6.3 : DNS, Domain Name System, translates hostnames or URLs into IP addresses. For example if we type www....0 comments |
- Grive: An Unofficial, Open Source Linux Client For Google Drive
- Install nSnake Game In Terminal
- How To “Fix E: Could not open file /var/lib/dpkg/status”
- Wow! Linux Foundation To Offer Free Linux Course This Summer Worth $2,400 on EdX
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .