Lamp Component Introduction
- Lamp refers to Linux, Apache,mysql and PHP abbreviation, many production environments are used lamp architecture, in the Network application and development environment, lamp combination is very good, their combination provides a powerful function.
- Linux, as the underlying operating system, provides a flexible and secure application platform, which guarantees the stable operation of other components.
- Apache, as a Web server, provides a powerful, stable and supportive web platform;
- MySQL is also a good database software;
- PHP is a development scripting language, can be embedded in HTML, for Web development;
Preparatory work
Operating system: RHEL 6.5
Related software package: Baidu Network disk Password: Bty7
The native system image is mounted to/mnt/cdrom/(used when installing a dependent package)
Second, MySQL installation
Unzip MySQL file to/opt/
tar zxvf mysql-5.5.24.tar.gz -C /opt/
- Installation environment package, GCC, gcc-c++, make, CMake
yum install gcc gcc-c++ make cmake -y
- Installing Ncurses-devel, bison, libaio-devel packages
#进入系统镜像Packages目录下,安装三个依赖包cd /mnt/cdrom/Packagesrpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpmrpm -ivh bison-2.4.1-5.el6.x86_64.rpmrpm -ivh libaio-devel-0.3.107-10.el6.x86_64.rpm
- Add MySQL user and join to MySQL Group
groupadd mysqluseradd -g mysql mysql -s /sbin/nologinmkdir -p /usr/local/mysql
5. Go to the MySQL installation file directory
cd /opt/mysql-5.5.24
5.1 Configuration
Cmake-dcmake_install_prefix=/usr/local/mysql
-dmysql_unix_addr=/home/mysql/mysql.
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_extra_charsets=all
-dwith_myisam_storage_engine=1
-dwith_innobase_storage_engine=1
-dwith_memory_storage_engine=1
-dwith_readline=1
-denabled_local_infile=1
-dmysql_datadir=/home/mysql
-dmysql_user=mysql
-dmysql_tcp_port=3306
5.2 Compiling and installing the software
make && make install
If error, empty cache file-if normal can be ignored
Find-name CMakeCache.txt
Rm-f./cmakecache.txt
- Modify MySQL file's owner, genus Group
chown -R mysql.mysql /usr/local/mysql
- Adding Global environment variables
#在最后一行加入
Path= $PATH:/usr/local/mysql/bin/
: wq! #保存退出
- Reload Profile Contents
- Go to MySQL directory, copy my.cnf (config file), mysqld (startup script)
cd /opt/mysql-5.5.24/cp support-files/my-medium.cnf /etc/my.cnfcp support-files/mysql.server /etc/init.d/mysqld
- Modify permissions for mysqld startup scripts
chmod 755 /etc/init.d/mysqld#将mysqld服务添加进系统服务中,并设置init3、init5中开机自启动chkconfig --add /etc/init.d/mysqld chkconfig --level 35 mysqld on
- Initializing MySQL Database
/usr/local/mysql/scripts/mysql_install_db \
--user=mysql \
--ldata=/var/lib/mysql \
--basedir=/usr/local/mysql \
--datadir=/home/mysql
12. Create a soft link file
ln -s /var/lib/mysql/mysql.sock /home/mysql/mysql.sock # 直接建立软连接
- Edit mysqld startup script, set Basedir, DataDir directory
vim /etc/init.d/mysqld
Basedir=/usr/local/mysql
Datadir=/home/mysql
- Turn on the MYSQLD service and check if the service starts properly
service mysqld startnetstat -ntap | grep 3306
- Go to MySQL database and view all databases
mysql>show databases;
Now that the MySQL service is deployed, see the next chapter deploying PHP services.
Lamp Deployment--two. Compiling and installing MySQL