LAMP install

From Initq

Jump to: navigation, search

LAMP stands for linux-Apache-Mysql-PHP. In this article we will explain how to install apache, mysql and php from source. All distros have excellent packaging systems that are rpm or deb based. We recommend that you use the distro package system to install because it will managed in a proper fashion when time comes to upgrade. Still it is always best to know how to install things from source just in case it is needed. If you have these packages already installed on your machine through the distro then try to stop them from running through the services.

We are not going to waste time on the Linux part. You should have a bootable distro with internet access. First we will install some tools that will be needed for compiling.

Contents

Tools needed

You will be needing gcc and g++ compilers so please install those.

MySQL Install

You can download any mysql that is GA, GA stands for Generally Available. The site is http://www.mysql.com/downloads/mysql/.

cd /usr/local/src
wget http://www.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.46-linux-x86_64-glibc23.tar.gz/from/http://mysql.mirrors.hoobly.com/
tar -xvzf mysql-5.1.46-linux-x86_64-glibc23.tar.gz
chown -R root.root mysql-5.1.46-linux-x86_64-glibc23
cd mysql-5.1.46-linux-x86_64-glibc23

Add the group and user for mysql.

groupadd mysql
useradd -g mysql -c "MySQL Server" mysql

Now lets try to install. MySQL does not give us source code anymore so all packages comes precompiled.

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &

MySQL Security Issues

First, we will assume that only applications on the same server will be allowed to access the database (i.e., not a program running on a physically separate server). So we'll tell MySQL not to even listen on port 3306 for TCP connections like it does by default.

Edit /etc/my.cnf and uncomment the

skip-networking

or you can put bind-address = 127.0.0.1 if you still want to remotely connect then you can do bind-address = 0.0.0.0


Set root password

mysqladmin -u root password new-password

Test MySQL

mysql -u root -p
mysql>
drop database test;
use mysql;
delete from db;
delete from user where not (host="localhost" and user="root");
flush privileges; 
update user set user="sqladmin" where user="root";
flush privileges;
Personal tools