Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Source code installs LAMP architecture

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

I. purpose of the experiment

Deploy the LAMP environment through source code and deploy phpmyadmin on this basis

2. Content of the experiment

Build a network YUM repository in the virtual machine, install httpd php php-server mysql (mairadb) and its respective dependent libraries and related toolkits in turn, and verify the connection between php and httpd, php and mysql, respectively, and then deploy phpmyadmin in the root path of the web page and verify it in the browser.

III. Experimental environment and preparation

A Centos6 virtual machine with the network card set to bridge mode and connected to the xshell

Fourth, experimental analysis and design ideas

To build the LAMP architecture in Centos6, first build the network YUM repository, turn off the firewall and selinux mechanism, install the driver module of httpd php mariadb and php combined with database, and install the libraries and related toolkits that php depends on, change the httpd main configuration file, let the index page support php, and write a php test page to verify the connection between php and httpd on the browser, then modify the main configuration file of the database and start the database service. You can check whether port 3306 is listening, write a test page, and verify the connection between php and mariadb databases. Continue to deploy the discuz forum project on Centos7, pull the project zip package to the server, unzip the upload directory and move it to the root path of the web page, then create a user to manage all the data of the bbs data corresponding to discuz, start deploying the forum project on the browser, and follow the instructions.

Five: the main experimental process

Experiment 1: build LAMP architecture in Centos-6

Compile and install apache

1. Build a network YUM source

Wget http://mirrors.aliyun.com/repo/Centos-6.repo

Yum-y install epel-release

2. Delete dependent library programs, installation environment and compilation tools that come with httpd programs and install httpd

Yum-y remove httpd

Yum-y install pcre-devel openssl-devel perl gcc gcc-c++

3, compile apr apr-util (first get the three packages ready and put the httpd script in)

And decompress the three packages needed at present to the specified path in turn.

Cd / usr/src/apr-1.5.2

. / configure-- prefix=/usr/local/apr & & make & & make install # compiling apr

Cd / usr/src/apr-util-1.5.3

. / configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/apr & & make & & make install

# compiling apr-util

4, create a program user and edit httpd

Useradd-r httpd

Tail-1 / etc/passwd # can see whether the user has created it successfully.

Cd / usr/src/httpd-2.4.10

Rm-rf / etc/httpd # Delete the previous httpd configuration file

. / configure-- prefix=/usr/local/apache-- sysconf=/etc/httpd-- enable-so-- enable-ssl-- enable-cgi-- enable-rewrite-- with-zlib-- with-pcre-- with-arp=/usr/local/apr-- with-apr-util=/usr/local/apr-util-- enable-modules=most-- enable-mpms-shared=all-- with-mpm=event & & make & & make install # compile httpd

5. Optimize the execution path (PATH path) and reread the configuration path

Cd / usr/local/apache/bin # entry

Vim / etc/profile.d/httpd.sh # configure environment variables

. / etc/profile.d/httpd.sh # execute script

Httpd-t # checks the syntax to test whether the environment variable of httpd is valid

Vim / etc/httpd/httpd.conf # start the central host and modify the httpd domain name

6. Copy the service startup and stop script and modify it

Cd ~

Vim httpd

Mv httpd / etc/init.d/

Service httpd start # start the httpd service

Ss-tnl # to see if port 80 is listening

7, enable the deflate and rewrite modules, and change the owner and group

Vim / etc/httpd/httpd.conf

Ps aux # check to see if the change was successful

8, check the syntax and start the service, and verify whether the service is enabled in the browser

Httpd-t

Service httpd restart

Compile and install mariadb

1. Install dependent libraries

Yum-y install ncurses-devel libevent-devel

2, install the compilation tool, and then clear the compilation cache file

Cd / usr/src/cmake-2.8.12.2

. / bootstrap & & gmake & & gmake install

Rm-rf CMakeCache.txt

3. Create the data directory of mysql program users and databases, and start compiling mariadb

Mkdir-pv / mydata/data

Useradd-r mysql

Cd / usr/src/mariadb-5.5.44

Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/mydata/data-DSYSCONFDIR=/etc-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_READLINE=1-DWITH_SSL=system-DWITH_ZLIB=system-DWITH_LIBWRAP=0-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci & & make & & make install

4. Modify the master group of the mysql configuration directory and the data directory

Chown-R root.mysql / mydata

Chown-R root.mysql / usr/local/mysql

5. Copy and configure the mysql master configuration file, and then copy the service startup and shutdown script

Cat / usr/local/mysql/support-files/my-medium.cnf > / etc/my.cnf

Vim / etc/my.cnf

Cp-p / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld

6. Initialize mysql (under / etc/local/mysql path)

Scripts/mysql_install_db-user=mysql-datadir=/mydata/data

7, boot httpd and mysql automatically

Chkconfig-add httpd

Chkconfig-add mysqld

Chkconfig httpd on

Chkconfig mysqld on

8, optimize the path path, then start the service, verify the effect and change the root user password

Vim / etc/profile.d/mysql.sh

. / etc/profile.d/mysql.sh # startup script

Service mysqld start

Ss-tnl # to see if port 3306 is listening

Mysql # enter the mysql command line interface

Use mysql # access to mysql database

Delete from mysql.user where user=''

Set a password for root users

Update user set password=password ('666666')

Flush privileges

Mysql-u root-p # password is required to enter mysql

Install PHP5.5.7

1. Install dependent libraries and corresponding environment

Yum-y install bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel

2, start compiling php5.5.7

Cd ~

Tar xf php-5.5.7.tar.gz-C / usr/src

Cd / usr/src/php-5.5.7

/ configure-- prefix=/usr/local/php-- with-mysql=/usr/local/mysql-- with-openssl-- with-mysqli=/usr/local/mysql/bin/mysql_config-- enable-mbstring-- with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib-- with-libxml-dir=/usr-- enable-xml-- enable-sockets-- with-apxs2=/usr/local/apache/bin/apxs-- with-mcrypt-- with-config -file-path=/etc-with-config-file-scan-dir=/etc/php.d-with-bz2-enable-maintainer-zts & & make & & make install

3. Open the httpd main configuration file, determine whether the php module is added, and modify the configuration information to support php connection.

Vim / etc/httpd/httpd.conf

Httpd-t

Service httpd restart

4. Copy the main configuration file of php

Cp-p / usr/src/php-5.5.7/php.ini-production / etc/php.ini

5. Restart the apache service, write a test page, and verify the connection of the LAMAP architecture

Service httpd restart

Cd / usr/local/apache/htdocs

Mv index.html index.php

Vim index.php

Just verify it on the browser.

Deploy phpmyadmin

1, extract the phpmyadmin and move the file into the apache

Tar xf phpMyAdmin-4.0.10.17-all-languages.tar.gz

Mv phpMyAdmin-4.0.10.17-all-languages phpmyadmin

Cp-rf phpmyadmin/ / usr/local/apache/htdocs/

2, copy the master configuration file

Cp config.sample.inc.php config.inc.php

Vim config.inc.php

3, just verify it on the browser

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: 224

*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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report