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

Build LAMP environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Build LAMP environment

I. introduction of the environment

Second, dependent software must be installed

3. Compile and install httpd-2.2.27

Fourth, binary installation of mysql-5.5.33

Fifth, compile and install PHP-5.3.27

Check whether apache is connected to mysql apache and php

I. introduction of the environment

Set up this environment, all services are installed in a virtual machine, here to introduce my virtual machine

CentOS-6.7-x86_64 ensures that the virtual machine can access the Internet normally.

IP:192.168.100.138

Hostname:yuci

Close iptables selinux

Second, install dependency packages

Yum-y install zlib zlib-devel

3. Compile and install httpd-2.2.27

Before installing httpd, you should set up a directory dedicated to storing the installation package for easy management.

Mkdir-p / home/yuci/tools

Compile and install httpd

Cd / home/yuci/tools/

Tar zxf httpd-2.2.27.tar.gz

* compilation parameters *

. / configure\

-- prefix=/application/apache2.2.27\

-- enable-deflate\

-- enable-expires\

-- enable-headers\

-- enable-modules=most\

-- enable-so\

-- with-mpm=worker\

-- enable-rewrite

* *

Make & & make install

Create a soft connection and take out the version number

Ln-s / application/apache2.2.27/ / application/apache

Check the syntax of the apache configuration file and start

/ application/apache/bin/apachectl-t

/ application/apache/bin/apachectl start

Check whether port 80 is open

Lsof-I: 80

View the service process of apache

Ps-ef | grep httpd

Access the ip address of the server through the browser

Test whether apache is installed correctly

Fourth, binary installation of mysql-5.5.33

Drag and drop binary mysql to the / home/yuci/tools directory and extract it

Tar zxf mysql-5.5.33-linux2.6-x86_64.tar.gz

Move the extracted mysql to the installation directory of / application and keep the version number

Mv mysql-5.5.33-linux2.6-x86_64 / application/mysql-5.5.33

Create a soft connection and cancel the version number

Ln-s / application/mysql-5.5.33/ / application/mysql

Create a mysql user and check

Useradd-s / sbin/nologin/-M mysql

Initialize mysql and see two OK instructions indicating that the installation and configuration of mysql so far is normal.

/ application/mysql/scripts/mysql_install_db-basedir=/application/mysql-datadir=/application/mysql/data/-user=mysql

Authorize mysql users and check

Chown-R mysql:mysql / application/mysql-5.5.33/

Copy the configuration file for mysql, my.cnf

Cp / application/mysql/support-files/my-small.cnf / etc/my.cnf

Mysql_safe is the startup script for mysql, and the default mysql installation location is / usr/local/mysql

But our installation path is / application/mysql, so we need to change it through sed

Sed-I-I

Try to start mysql and put it into the background to execute

/ application/mysql/bin/mysqld_safe &

Check port 3306 of mysql to confirm that mysql is started

Lsof-I: 3306

By checking the port, you can see that mysql has been started, but you still need to configure environment variables to log in to mysql.

Just add it on the last line of the / etc/profile file. Don't forget to refresh the file after saving it.

Vim / etc/profile

PATH= "/ application/mysql/bin:$PATH"

Source / etc/profile

Try to log in to mysql

Now mysql can log in normally, but some other configurations are needed.

Copy the startup script of mysql, modify the installation path, and add execution permissions to facilitate the restart of mysql.

Cp / application/mysql/support-files/mysql.server / etc/init.d/mysqld

Sed-I-I

Chmod + x / etc/init.d/mysqld

Kill the msyql process with the killall command and execute it several times until no process killed appears

Killall mysqld

Reconfirm that the mysql service has stopped completely

Lsof-I: 3306

Start mysql with the script you just copied and check the port

/ etc/init.d/mysqld start

Lsof-I: 3306

Add self-boot to mysql and check

Chkconfig mysqld on

Chkconfig-list mysqld

Set a password for the mysql administrator

Mysqladmin-uroot password "123456"

Successfully log in to mysql and the installation is complete.

Mysql-uroot-p123456

Fifth, compile and install php-5.3.27

Install the required dependent software through yum

Yum-y install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel openssl-devel libxslt-devel

Install libiconv softwar

Tar zxf libiconv-1.14.tar.gz

Cd libiconv-1.14

. / configure-- prefix=/usr/local/libiconv

Make & & make install

Install php softwar

Tar zxf php-5.3.27.tar.gz

Cd php-5.3.27

* compilation parameters *

. / configure\

-- prefix=/application/php5.3.27\

-- with-apxs2=/application/apache/bin/apxs\

-- with-mysql=/application/mysql\

-- with-xmlrpc\

-- with-openssl\

-- with-zlib\

-- with-freetype-dir\

-- with-gd\

-- with-jpeg-dir\

-- with-png-dir\

-- with-iconv=/usr/local/libiconv\

-- enable-short-tags\

-- enable-sockets\

-- enable-zend-multibyte\

-- enable-soap\

-- enable-mbstring\

-- enable-static\

-- enable-gd-native-ttf\

-- with-curl\

-- with-xsl\

-- enable-ftp\

-- with-libxml-dir

* * *

Make & & make install

Create a soft connection to take out the version number and check

Ln-s / application/php5.3.27/ / application/php

Ll / application/

View configuration fil

[root@yuci php-5.3.27] # ls php.ini-*

Php.ini-development (development environment)

Php.ini-production (production environment)

Copy configuration fil

Cd / home/yuci/tools/php-5.3.27

Cp php.ini-production / application/php/lib/php.ini

Edit and back up configuration fil

Cd / application/apache/conf/

Cp httpd.conf httpd.conf.ori

Vim httpd.conf (311gg)

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

Edit the httpd.conf file

Cd / application/apache/conf/

Vim httpd.conf (166gg)

Create a test file in the home file directory of apache to check whether the connection between apache and php is normal.

Cd / application/apache/htdocs/

Vim index.php

[root@yuci htdocs] # cat index.php

Create a test file in the home file directory of apache to check whether the connection between mysql and php is normal.

Cd / application/apache/htdocs/

Vim mysql.php

[root@yuci htdocs] # cat mysql.php

Check the apache syntax and load smoothly

/ application/apache/bin/apachectl-t

/ application/apache/bin/apachectl graceful

Check whether apache is connected to mysql apache and php

Tested separately in the browser, the connection was successful

The LAMP environment has been built

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.

Share To

Database

Wechat

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

12
Report