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

Centos 6.5Compiler and install LAMP

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

Share

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

I. Preface

1. Environmental description

Basic environment Linux+Apache+MySQL+PHP

Linux:6.5

Apache 2.2.12

Mysql:5.6.17

Php:5.5.12

2. Deployment instructions

Php installation directory: / usr/local/php

Php.ini profile path: / usr/local/php/etc/php.ini

Apache installation directory: / usr/local/nginx

II. Preparatory work

1. Minimize installation of Centos6.5

Create a software storage directory

Mkdir / tools

Because there is nothing in the system just installed, so just operate it.

[root@mail2 httpd-2.2.32] # setenforce 0 temporarily disable selinux

[root@mail2 httpd-2.2.32] # server iptables stop turn off the firewall

2. Install the necessary tools

Yum-y install make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof

Third, install httpd

Wget http://apache.fayea.com/httpd/httpd-2.2.32.tar.gz

Tar zxvf httpd-2.2.32.tar.gz

Cd httpd-2.2.32

. / configure\

-- prefix=/usr/local/apache\

-- enable-deflate\

-- enable-expires\

-- enable-headers\

-- enable-modules=most\

-- enable-so\

-- with-mpm=worker\

-- enable-rewrite

Make & & make

[root@mail2 httpd-2.2.32] # cd / usr/local/apache/bin/apachectl restart launch httpd

[root@mail2 httpd-2.2.32] # ps-ef | grep httpd checks whether httpd is started

The default user for compiling and installing apache is daemon if you want to modify it in the main configuration file.

Third, install mysql

[root@mail2 tools] # groupadd mysql

[root@mail2 tools] # useradd-s / sbin/nologin-g mysql-M mysql # create a new mysql group and user

MySQL has been compiled and configured through. / configure since version 5. 5 and has been replaced by the cmake tool. Therefore, we first need to compile and install the cmake tool in the system.

Wget http://wwwNaNake.org/files/v2.8/cmake-2.8.12.2.tar.gz

Tar zxvf cmake-2.8.12.2.tar.gz

Cd cmake-2.8.12.2

. / configure

Make & & make install

If the error is not displayed, the installation is successful. If there is an error, be sure to read the error report carefully before dealing with the problem. It could be an environmental problem.

2. Use cmake to compile and install MySQL 5.6.17

Wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz

Tar zxvf mysql-5.6.17.tar.gz

Cd mysql-5.6.17

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_DATADIR=/usr/local/mysql/data\

-DSYSCONFDIR=/etc\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock\

-DMYSQL_TCP_PORT=3306\

-DENABLED_LOCAL_INFILE=1\

-DWITH_PARTITION_STORAGE_ENGINE=1\

-DEXTRA_CHARSETS=all\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DMYSQL_USER=mysql\

-DWITH_DEBUG=0\

-DWITH_SSL=system

Make & & make install

# modify / usr/local/mysql permissions

Chown-R mysql:mysql / usr/local/mysql

Cd support-files/

# Please back up if you still have my.cnf

Mv / etc/my.cnf / etc/my.cnf.bak

Cp my-default.cnf / etc/my.cnf

# execute the initialization configuration script, create the database and table that comes with the system, and pay attention to the path of the configuration file

/ usr/local/mysql/scripts/mysql_install_db\

-- defaults-file=/etc/my.cnf\

-- basedir=/usr/local/mysql\

-- datadir=/usr/local/mysql/data\

-- user=mysql

# copy support-files service scripts under the mysql installation directory to the init.d directory

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

# Grant permissions, set boot and boot

Chmod + x / etc/init.d/mysqld

Chkconfig mysqld on

Service mysqld start

# or

/ etc/init.d/mysql start

After MySQL5.6.x starts successfully, root does not have a password by default. We need to set the root password. Before setting up, we need to set PATH, otherwise we can't call mysql directly.

# modify / etc/profile file

Vim / etc/profile

# add at the end of the file

PATH=/usr/local/mysql/bin:$PATH

Export PATH

# Let the configuration take effect immediately

Source / etc/profile

# Log in test. There is no password by default. Enter directly and then enter.

Mysql-uroot-p

# set mysql password

/ usr/local/mysql/bin/mysqladmin-uroot-p password 'your password'

# Log in to command line mode

Mysql-uroot-p

# View users

> select user,host from mysql.user

# Delete unnecessary users

> drop user "" @ localhost

> drop user root@'::1'

# Grant remote access permissions to the account

> GRANT ALL PRIVILEGES ON *. * TO 'root'@'127.0.0.1' IDENTIFIED BY' your password

> GRANT ALL PRIVILEGES ON *. * TO 'root'@'localhost' IDENTIFIED BY' your password

# query some other information:

# check mysql version

Mysql-uroot-p "password"-e "select version ();"

Fourth, install PHP5.5.12

Wget http://mirrors.sohu.com/php/php-5.5.12.tar.gz

Tar zxvf php-5.5.12.tar.gz

Cd php-5.5.12

. / configure\

-- prefix=/usr/local/php\

-- with-config-file-path=/usr/local/php/etc\

-- with-apxs2=/usr/local/apache/bin/apxs,

-- with-mysql=/usr/local/mysql/

-- enable-fpm\

-- with-fpm-user=www\

-- with-fpm-group=www\

-- with-mysql=mysqlnd\

-- with-mysqli=mysqlnd\

-- with-pdo-mysql=mysqlnd\

-- with-iconv-dir\

-- with-freetype-dir\

-- with-jpeg-dir\

-- with-png-dir\

-- with-zlib\

-- with-libxml-dir=/usr\

-- enable-xml\

-- disable-rpath\

-- enable-magic-quotes\

-- enable-safe-mode\

-- enable-bcmath\

-- enable-shmop\

-- enable-sysvsem\

-- enable-inline-optimization\

-- enable-mbregex\

-- enable-mbstring\

-- with-mcrypt\

-- enable-ftp\

-- with-gd\

-- enable-gd-native-ttf\

-- with-openssl\

-- with-mhash\

-- enable-pcntl\

-- enable-sockets\

-- with-xmlrpc\

-- enable-zip\

-- enable-soap\

-- without-pear\

-- with-gettext\

-- disable-fileinfo\

-- enable-maintainer-zts

Make & & make install

# modify the name of fpm configuration php-fpm.conf.default file

Mv / usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

# copy php.ini configuration file

Cp php.ini-production / usr/local/php/etc/php.ini

# copy php-fpm startup script to init.d

Cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm

# Grant execution permission

Chmod + x / etc/init.d/php-fpm

# add as Startup item

Chkconfig-add php-fpm

# set Boot Startup

Chkconfig php-fpm on

# create a specified user and group for php-fpm according to the standard

# create a group

Groupadd www

# create a user, do not allow login and do not create home directory

Useradd-s / sbin/nologin-g www-M www

# start php-fpm immediately

/ etc/init.d/php-fpm start

Check php-fpm startup

Now the three applications have been launched successfully.

Now test whether php is enabled successfully. The landing status of Mysql

In the main configuration file #

DirectoryIndex index.php index.html

Join index.php

Join around 311

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

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

Restart apache/ usr/local/apache/bin/apachectl graceful

The default website directory for compiling and installing apache is located in / usr/local/apache/htdocs

If it shows that it has been successful. Then test the server connection.

If the mysql welcome to lkq.com is displayed successfully

It has been successful. Then try shutting down mysql now.

Test and see the page

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