In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Overview of LAMP application platform:
1. Summary: LAMP is the most mature enterprise website application model at present, which can provide dynamic web site application and development environment, and it forms languages such as linux, apache, mysql, php or python or perl. Its advantages: low cost, easy to develop, easy to use, secure and stable.
two。 Website classification:
Static: there are pages written in pure html tag language, no matter in what environment, what identity access will not change.
Dynamic: written by the programming language of web pages, for example: java, php,. Net, python, dynamic pages, dynamic pages are composed of dynamic pages and html to form a web page, which can interact with the database and can be operated on the server through dynamic pages.
3.php (Hypertext preprocessing language): it is a server-side html embedded language that supports windows, linux, unix and other platforms.
2. Working principle of LAMP:
The processing flow of 1.LAMP:
Apache: provides web access and web page transmission between the client and the server
Php: provides a runtime environment for .php pages
Mysql: provides a .php page or location for storing and writing user data
Case III: deployment of LAMP application platform
Case listing environment
1.apache installs apache components httpd-2.4.29.tar.gztapr-1.6.2.tar.gz apr-util-1.6.0.tar.gz (cross-platform tool package)
1. Prepare the apache installation package
Tar xf / mnt/apr-1.6.2.tar.gz-C / opt # extract the cross-platform component package to the / opt directory tar xf / mnt/apr-util-1.6.0.tar.gz-C / opt # extract the cross-platform component package to the / opt directory tar xf / mnt/httpd-2.4.29.tar.bz2-C / opt # extract the apache installation package mv / opt/apr-1.6.2 / opt/httpd-2.4 .29 / srclib/apr # cut the cross-platform component package to the / httpd-2.4.29/srclib directory and rename it to aprmv / opt/apr-util-1.6.0 / opt/httpd-2.4.29/srclib/apr-util
two。 Equipment environment package
Yum-y install\ gcc\ # C language compiler gcc-c++\ # C++ compiler make\ # make tool (convert source code file to binary executable file) Development of pcre-devel\ # pcre language expat-devel\ # parse html file perl # pace editor
3. Configure apache
Cd / opt/httpd-2.4.29 # cd to httpd-2.4.29 directory. / configure\-- prefix=/usr/local/httpd\ #-- prefix customizes the directory to which the httpd service program is installed-- enable-so\ #-- enable-so enables dynamic module support, so that httpd has the ability to further extend functions-- enable-rewrite\ #-- enable-rewrite enables web address rewriting For website optimization and directory migration maintenance-- enable-charset-lite\ #-- enable-chaset-lite enables character support for pages encoded with various character sets-- enable-cgi # enables CGI script support to expand the application access capabilities of the website
4. Compilation and installation
[root@hui httpd-2.4.29] # make # convert source code into executable program [root@hui httpd-2.4.29] # make install # installation
5. Add httpd system services (configure startup scripts, create service scripts that can be controlled)
[root@hui ~] # cp / usr/local/httpd/bin/apachectl / etc/init.d/httpd # copy apachetcl (startup script) to / etc/init.d/ httpd` [root@hui ~] # sed-I-e'1a # chkconfig:35 85 21'- e'2 I # description: Apache is a World Wide Web server' / etc/init.d/ httpd` # add chkconfig identification configuration at the beginning of the file, chkconfig:35 8521 / / service identification parameter, at level 3 Start in 5 The order of startup and shutdown is 85 and 21 [root@hui ~] # chkconfig-- add httpd # add httpd as a system service
6. Determine the website name, IP address, and configure the httpd service
[root@hui ~] sed-I'/ # ServerName www.example.com.com:80/s/example/yum/'/ usr/local/httpd/conf/httpd.conf # modify the website name [root@hui ~] sed-I-e'/ Listen 80/s/ ^ / # /'- e'/ # Listen 12.34.56.78:80/s/#Listen 12.34.56.78:80/Listen 192.168.242.157 Listen 12.34.56.78:80/s/#Listen 12.34.56.78:80/Listen'/ usr/local / httpd/conf/httpd.conf # modify the IP address of the web host
7. Optimized execution path-for httpd services that are compiled and installed by source code, the program path is not in the default search path. In order to make it easier to use the service, you can add symbolic links to related programs.
[root@hui ~] ln-s / usr/local/httpd/conf/httpd.conf / etc/ # [root@hui ~] ln-s / usr/local/httpd/bin/* / usr/local/bin/
8. Turn off the firewall and start the service
Systemctl stop firewalld.service
Setenforce 0
Service httpd start
two。 Install Mysql
1. Install the environment package
[root@hui ~] # yum install-y ncurses-devel autoconf cmake
two。 Source code compilation and installation
(1) unpack
[root@hui mnt] # tar / mnt/mysql-5.6.26.tar.gz-C / opt
(2) configuration
[root@hui mysql-5.6.26] # cd / opt/mysql-5.6.26/
[root@hui mysql-5.6.26] cmake\-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # specify the installation of the mysql database program to the directory-DDEFAULT_CHARSET=utf8\ # specify the character set encoding used by default-DDEFAULT_COLLATION=utf8_general_ci\ # specify the default character set check rules-DEXTRA_CHARSETS=all\ # extended character set-DSYSCONFIDIR=/etc\ # specify the initialization parameter file directory -DMYSQL_DATADIR=/home/mysql/\-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock # Connect the database file
(3) compile and install
[root@hui mysql-5.6.26] # make & & make install
3. Add system services and establish configuration files (add mysql system services for management through chkconfig, you can use the service scripts provided in the source package directly. Find the mysql.server script file in the support-files folder, copy it to the / etc/init.d/ directory, and rename it to mysqld)
[root@hui mysql-5.6.26] # cp-f support-files/my-default.cnf / etc/my.cnf # copy the configuration file to the / etc/ directory and rename it to my.cnf [root@hui mysql-5.6.26] # cp support-files/mysql.server / etc/init.d/mysqld # copy the startup file to the / etc/init.d/ directory and rename it to mysqld. [root@hui mysql-5.6.26] # chmod 755 / etc/init.d/mysqld # set executable permissions [root@hui mysql-5.6.26] # chkconfig-- add / etc/init.d/mysqld # add it as a mysqld system service through the chkconfig command, so you can use the service tool to control the mysql database service [root@hui mysql-5.6.26] # chkconfig mysqld-- level 235 on
4. Set the environment variable-to facilitate the use of the mysql command in any directory, you need to set the environment variable in / etc/profile.
[root@hui mysql-5.6.26] # echo "PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile # set the environment variable of the mysql command [root@hui mysql-5.6.26] # source / etc/profile # execute immediately
5. Key operating users-in order to strengthen the access control of database services, it is recommended to use specialized operating users, such as mysql. This user does not need to log in directly to the system
[root@hui mysql-5.6.26] # useradd-s / sbin/nologin mysql # create mysql user
[root@hui mysql-5.6.26] # chown-R mysql:mysql / usr/local/mysq sets permissions on database directories
6. Initialize the database-in order to use the mysql database system normally, execute the initialization script mysql_install_db, specify the data storage directory, etc., as the user mysql.
/ usr/local/mysql/scripts/mysql_install_db\-user=mysql\-ldata=/var/lib/mysql\-basedir=/usr/local/mysql\-datadir=/home/mysql
7.
[root@hui mysql-5.6.26] # ln-s / var/lib/mysql/mysql.sock / home/mysql/mysql.sock [root@hui mysql-5.6.26] # sed-I-e'/ basedir=/c basedir=/usr/local/mysql'-e 'datadir=/c datadir=/home/mysql' / etc/init.d/mysqld [root@hui mysql-5.6.26] # service mysqld start [root@hui mysql-5.6.26] # mysqladmin-u Root-p password "abc123" / / set password three to the root account. Install PHP
1. Equipment environment
[root@localhost ~] yum-y install\ gd\ # Image processing library libpng\ # supports png images libpng-devel\ pcre\ # supports regular expressions pcre-devel\ # supports regular expressions libxml2-devel\ # supports parsing html language libjpeg-devel # supports jpeg images
two。 Compile and install PHP
(1)。 Decompression
[root@localhost] tar xf php-5.6.11.tar.bz2-C / opt [root@localhost opt] # cd / opt/php-5.6.11/
(2)。 Configuration
[root@localhost php-5.6.11] #. / configure\-- prefix=/usr/local/php5\ # specify installation path-- with-gd\ # gd Library-- with-zlib\ # Compression-- with-apxs2=/usr/local/httpd/bin/apxs\ # set the file location of the apxs module support program provided by Apache HTTPServer-- with-mysql=/usr/local/mysql\ # set the installation bit of the Mysql database service program Set-- with-config-file-path=/usr/local/php5\ # set the location where PHP's configuration file php.ini will be stored-- enable-mbstring # enable the multi-byte string function In order to support Chinese code
(3) compilation and installation
[root@localhost php-5.6.11] # make [root@localhost php-5.6.11] # make install
3. Set up the LAMP component environment
Set up the LAMP component environment, including the adjustment of the configuration file php.ini of PHP and the configuration file httpd.conf of Apche. The former is used to determine the running parameters of PHP, and the latter is used to load the libphp5.so module to support php web pages.
(1) adjust the configuration file
[root@localhost php-5.6.11] # cp php.ini-development / usr/local/php5/php.ini # copy the configuration file to the / usr/local/php5/ directory and name it: php.ini [root@localhost php-5.6.11] # ln-s / usr/local/php5/bin/* / usr/local/bin/ # soft link to the / usr/local/php5/bin/* command to facilitate system identification
(2)。 Adjust httpd.conf configuration
For the httpd server to support PHP web page parsing, you need to load the module file of the PHP program through the LoadModule configuration and add support for the ".php" type web page file through the AddType configuration item.
[root@localhost ~] # sed-I'/ DirectoryIndex index.html/ c DirectoryIndex index.html index.php' / etc/httpd.conf # modify * * DirectroryIndex** configuration line Add index.php to identify the common PHP home page file [root@localhost ~] # sed-I '393 an AddType application/x-httpd-php .php' / etc/httpd.conf # setting support for .PHP files [root@localhost ~] # sed-I '394 an AddType application/x-httpd-php-source .phps' / etc/httpd.conf # [root@localhost ~] cat > > / usr/local/httpd/htdocs/index.php > EOF
[root@localhost ~] # sed-I '394 an AddType application/x-httpd-php-source .phps' / etc/httpd.conf #
[root@localhost ~] cat > > / usr/local/httpd/htdocs/index.php
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.