Introduction to LAMP Architecture
Lamp architecture is one of the most mature application models of enterprise website, which refers to a complete set of system and related software, which can provide dynamic Web site service and its application development environment. The word lamp is an abbreviation, including: Linux operating system, Apache Web server, MySQL database server, PHP (or Perl, Python) Web programming language.
In the four constituent components of the lamp platform, each component is part of a critical application. Through the past more than 10 years of development, the compatibility between the components has been continuously improved, collaboration and stability has been enhanced, can build a very good Web application system. The main functions of each component are as follows.
l (Platform) Linux: As the basis of the lamp architecture, provides the operating system to support the Web site, with three other components to provide better stability, compatibility (AMP components also support Windows, UNIX and other platforms).
l (foreground) Apache: As the front end of the lamp architecture , is a powerful, stable Web server program, the server directly for users to provide Web site access, send Web pages, pictures and other file content.
l (backstage) MySQL: As the back end of the lamp architecture, is a popular open source relational database system. In the Enterprise website, business system and other applications, a variety of account information, product information, customer information, business data, etc. can be stored in the MySQL database, other programs can be queried through SQL statements, change this information.
l (Intermediate connection) Php/perl/python: As the three programming languages for developing dynamic Web pages, it is responsible for interpreting dynamic Web pages and providing the development and operating environment for Web applications. PHP is a widely used, open-source, multi-purpose scripting language that can be embedded in HTML, especially for Web application development.
Preparatory work
Operating System: Linux Redhat6.5
Related packages: Link: https://pan.baidu.com/s/1QOjFeAAwgc3rZ8PoV-4UWw password: 16ej
Mysql Installation Steps
1. unzip the MySQL archive package file to/opt/
Tar zxvf mysql-5.5.24.tar.gz-c/opt/
2. Install environment package, GCC, gcc-c++, make, CMake and Ncurses-devel, Bison, Libaio-devel package
#ncurses是字符终端下屏幕控制的基本库字符终端下屏幕控制的基本库
#bison是语法分析器
#libaio-devel is a package for synchronous I/O
Yum install gcc gcc-c++ make cmake ncurses-devel bison libaio-devel–y
3. add MySQL user and join to MySQL group
Groupadd MySQL
Useradd-g mysql-s/sbin/nologin MySQL
4. create MySQL installation directory
Mkdir-p/usr/local/mysql
5. go to the MySQL installation file directory to configure the installation
cd/opt/mysql-5.5.24
5.1 Configuration
cmake-dcmake_install_prefix=/usr/local/mysql # Specify the installation path
-dmysql_unix_addr=/home/mysql/mysql.sock # Specify the home directory for the sock database connection file
-ddefault_charset=utf8 # Specify the character set encoding to use by default
-ddefault_collation=utf8_general_ci # Specify character set varsity rules
-dwith_extra_charsets=all # Extended Character Set
-dwith_myisam_storage_engine=1 # turn on the MyISAM storage engine
-dwith_innobase_storage_engine=1 # turn on the innobase storage engine
-dwith_memory_storage_engine=1 # turn on the memory storage engine
-dwith_readline=1 # Open Support ReadLine program platform, is read data read by row
-denabled_local_infile=1 # To open a local write file
-dmysql_datadir=/home/mysql # specify the path where the database file is stored
-dmysql_user=mysql # Specify administrative users
-dmysql_tcp_port=3306 # Specify the TCP port number 3306
5.2 compiling and installing the software
Make && make install
6. Modify the MySQL file owner, the genus Group
Chown-r Mysql.mysql/usr/local/mysql
7. Add Global environment variables
Vim/etc/profile
#在最后一行加入
Path= $PATH:/usr/local/mysql/bin/
8. Reload profile contents after saving exit
Source/etc/profile
9 . 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.CNF
CP Support-files/mysql.server/etc/init.d/mysqld
Add execute permissions to a mysqld file
chmod 755/etc/init.d/mysqld
One by one . Add the MYSQLD service to the system service and set the boot from Init3, init5
Chkconfig--add/etc/init.d/mysqld
Chkconfig--level 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 #数据库文件的存放路径
Create a soft link file
Ln-s/var/lib/mysql/mysql.sock/home/mysql/mysql.sock # directly establish a soft connection
Edit mysqld startup script, set Basedir, DataDir directory
Vim/etc/init.d/mysqld
Basedir=/usr/local/mysql
Datadir=/home/mysql
Open the Mysqld service and check if the service starts properly
Service mysqld Start
Netstat-ntap | grep 3306
If the mysqld service is turned on, you can enter the MySQL command to access the MySQL database and view the database list information
Mysql
Mysql>show databases;
Lamp architecture Deployment--Compile and install MySQL