In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "CentOS7 source code compilation and installation of LAMP architecture". In daily operation, I believe that many people have doubts about CentOS7 source code compilation and installation of LAMP architecture. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "CentOS7 source code compilation and installation of LAMP architecture". Next, please follow the editor to study!
Source code compilation and installation of LAMP
Apache website service
MySQL service
Application example of LAMP Framework
The origin of Apache
Originated from A Patchy Server, the famous open source Web service software
In 1995, version 1. 0 of the Apache service program was released
Maintenance by the Apache Software Foundation (ASF)
The latest name is "Apache HTTP Server"
Official site: htp://ttpd.apache.org/
Main features
Open source and cross-platform applications
Support for multiple web programming languages
Modular design, stable operation and good security
Software version
1.X
At present, the highest version is 1.3, which runs stably.
Downward compatibility is better, but lacks some newer features
2.X
Currently, the highest version is 2.4
Have more functional features
Compared with 1.x, the style of configuration management is quite different.
The advantages of compiling and installing httpd server
With a large degree of freedom, the function can be customized.
You can get the latest software version in time.
It is generally suitable for most Linux versions and is easy to transplant.
Get the source package of the Apache server
Reference address:
Htp://httpd.apache.org/download.cgi
Preparatory work
Download the source package
Apr-1.6.2.tar.gz
Apr-util-1.6.0.tar.gz
Httpd-2.4.29.tar.bz2
Uninstall httpd and related dependent packages
[root@www] # rpm-e httpd-- nodeps / /-- nodeps ignores package-dependent source code compilation and installation
Put the downloaded source code package into the mnt directory in the Linux system
Cd / mnt/ / enter the mnt directory tar zxvf / mnt/apr-1.6.2.tar.gz-C / opt/ extract the http service cross-platform component package to the opt directory tar zxvf / mnt/apr-util-1.6.0.tar.gz-C / opt/tar jxvf / mnt/httpd-2.4.29.tar.bz2- C / opt/ unzip the http service source package to the opt directory mv / opt/apr-1.6.2 / opt/httpd-2.4.29/srclib/apr / / move the extracted cross-platform package to the httpd package srclib directory and change the name mv / opt/apr-util-1.6.0 / opt/httpd-2.4.29/srclib/apr-utilyum install\ / / install source code environment package gcc\ / / install c language compiler gcc-c++\ / install C++ compiler make\ / / install make tool pcre-devel\ / install Perl language development software expat-devel\ / / install tagged language parsing Perl-y / install Perl language compiler cd / opt/httpd-2.4.29/ enter the http package. / configure\ / execute the script configure--prefix=/usr/local/httpd\ / / specify the http service installation path-- enable-so\ / / Open the http service core module-- enable -rewrite\ / / enable rewriting function-- enable-charset-lite\ / / enable character set support In order to support web pages encoded with various character sets-enable-cgi / / Open the Universal Gateway Interface, a coding specification Can support the format of all website development languages make / / use the make tool to convert the file compilation configured above into an executable file make install / / install the http service cp / usr/local/httpd/bin/apachectl / etc/init.d/httpd / / add startup scripts It is convenient to control the startup of the service vim / etc/init.d/httpd / / enter the edit startup script file #! / bin/bash# chkconfig: 35 85 21 / / declare that 35 levels automatically open, 85 start, 21 close # description: Apache is a World Wide Web server / / declare the service type Add these two declarations under the first line. / / omit part of the contents.: wq / / Save exit chkconfig-- add httpd/ / add httpd to SERVICE Manager sed-I "51s/#Listen 12.34.56.78:80/Listen" Native IP address ": 80 /" / usr/local/httpd/conf / httpd.conf// change profile Change the listening address to the native IP address sed-I '52s/ ^ / # /' / usr/local/httpd/conf/httpd.conf// change the configuration file, close the sed-I '197s/#ServerName www.example.com:80/ServerName www.example.com:80/' / usr/local/httpd/conf/httpd.conf// change configuration file for the ipv6 listening address on line 52 Open ServerName ln-s / usr/local/httpd/conf/httpd.conf / etc/ to build a soft connection to the configuration file, and put it in the etc directory to facilitate the management of ln-s / usr/local/httpd/bin/* / usr/local/bin/ establish a soft connection to the system command file directory under the http directory. It is convenient for the system to identify httpd-t / / check whether there is something wrong with the service configuration syntax apachectl-tsystemctl stop firewalld.service / / turn off the firewall function setenforce 0 / / turn off the enhanced security function service httpd start / / start the service netstat-ntap | grep 80 / / check whether the port is opened successfully to verify the installation
Open a browser in the host and enter the IP address to verify that the httpd service is installed properly
Preparation for compilation and installation of MySQL
Download the source package
Mysql-5.6.26.tar.gz
Source code compilation and installation
Put the downloaded source code package into the mnt directory in the Linux system
Cd / mnt tar zxvf / mnt/mysql-5.6.26.tar.gz-C / opt/ / extract the source code package to the opt directory yum install-y ncurses-devel autoconf cmake / / install the environment package cd / opt/mysql-5.6.26/cmake\ / / use the cmake tool to configure-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ / / specify mysql installation path-DDEFAULT_CHARSET=utf8\ / specify character set-DDEFAULT_COLLATION=utf8_general_ci\ / specify character set type-DEXTRA_CHARSETS=all\ / specify extended character set-DSYSCONFIDIR=/etc\ / / specify profile directory-DMYSQL_DATADIR=/home/mysql/ \ / / specify the location of data files-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock / / define the location of sock communication files make / / use the make tool to compile and convert the above configured files into executable files make install / / install the mysql software rm-rf / etc/my.cnf / / delete the etc directory The mysql configuration file included with the system cp support-files/my-default.cnf / etc/my.cnf / / re-establish the configuration file in the etc directory cp support-files/mysql.server / etc/init.d/mysqld / / copy the file startup script to the init.d directory cd / etc/init.d/ enter the init.d directory chmod + x mysqld / / add execution permissions to the mysql file chkconfig-- add / etc/init.d/mysqld / / add services to service Manager chkconfig-- level 35 mysqld on / / set the MySQL service to 3, Enable echo "PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile / / declare environment variables at level 5 Append it to the profile file source / etc/profile / / redeclare the profile file echo $PATH / / output variable information to see if there is an appended MySQL command directory useradd-s / sbin/nologin mysql / / to create the mysql user Make it unable to log in to chown-R mysql:mysql / usr/local/mysql/ change all users and groups of all files in the mysql directory to mysql users, Group / usr/local/mysql/scripts/mysql_install_db\ / initialize mysql database information-- user=mysql\ / / specify the user of the database-- ldata=/var/lib/mysql\ / / specify the function library of the database-- basedir=/usr/local/mysql\ / / specify the work of the database Directory-- datadir=/home/mysql / / specify the storage location of the data sed-I '46s sed-I' 46sAccording to basedir =\ / usr\ / local\ / mysql/' / etc/init.d/mysqld sed-I '47s to enter the configuration file to fill in the working directory of the database and the location of the data service mysqld start / / start the database netstat-anpt | grep 3306 / / check whether the database port is open mysqladmin-u root-p password "123123" / / set the password for the mysql database administrator root account / / when you are prompted to enter the old password to confirm Because there is no old password, you can directly enter mysql-u root-p / / you can use this command to enter the database to install the PHP package preparation.
Download the source package
Php-5.6.11.tar.bz2
Source code compilation and installation
Put the downloaded source code package into the mnt directory in the Linux system
Cd / mnt/tar jxvf php-5.6.11.tar.bz2-C / opt/ decompress the php source package yum-y install\ / / installation environment gd\ / / install the GD library Image processing library libpng\ / install the library that parses PNG image format libpng-devel\ / / the installer processes PNG image format files development tool pcre\ / / install Perl language library pcre-devel\ / / install Perl language development software libxml2-devel\ / / install the XML language parsing tool libjpeg-devel / / the development tool for the installer to process jpg image format files cd / opt/php-5.6.11/ enter the extracted php directory. / configure\ / execute the configure script file-- prefix=/usr/local/php5\ / / specify the php installation path- -with-gd\ / / support gd library-- with-zlib\ / / support data compression function library-- with-apxs2=/usr/local/httpd/bin/apxs\ / / Associated http service-- with-mysql=/usr/local/mysql\ / / Associated mysql database-- with-config-file-path=/usr/local/php5\ / / configuration file associated with php-- enable-mbstring / / Open functional module make / / compile make install using make tool / / start installing php service cp php.ini-development / usr/local/php5/php.ini / / put the php configuration file in the php5 directory Change to php.iniln-s / usr/local/php5/bin/* / usr/local/bin/ put the command establishment soft connection file in the php directory into the / usr/local/bin/ directory sed-- follow-symlink-I '256s/DirectoryIndex index.html/ DirectoryIndex index.html index.php/' / etc/httpd.conf / / so that the http default home page can support the php format file sed-- follow-symlink-I '393a AddType application/x-httpd-php .php\ nAddType application/x-httpd-php-source .phps'/ etc/httpd.conf / / add entries to make http support php files echo-e "> / usr/local/httpd/htdocs/index.html / / write files Join the http default home page file mv / usr/local/httpd/htdocs/index.html / usr/local/httpd/htdocs/index.php / / change the default home page file to php file service httpd stop / / stop http service service httpd start / / start http service to verify installation
Open a browser in the host, enter the IP address, and verify that the web page shows the content of the page you just edited to test whether the PHP software is installed
PHP software was successfully installed and LAMP architecture was successfully built.
At this point, the study of "compiling and installing LAMP architecture in CentOS7 source code" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.