LAMP安装
@(linux学习笔记)
CentOS-6.7最小化安装 Mysql-5.6.28二进制免编译包[root@bogon opt]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz[root@bogon opt]# tar zxvf mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz -C /usr/local/src/[root@bogon opt]# mv /usr/local/src/mysql-5.6.28-linux-glibc2.5-x86_64/ /usr/local/mysql
Httpd-2.4.18源码包
[root@bogon opt]# wget http://mirrors.sohu.com/apache/httpd-2.4.18.tar.bz2[root@bogon opt]# tar jxvf httpd-2.4.18.tar.bz2 -C /usr/local/src/
Php-5.6.3源码包
[root@bogon opt]# wget http://mirrors.sohu.com/php/php-5.6.3.tar.bz2[root@bogon opt]# tar jxvf php-5.6.3.tar.bz2 -C /usr/local/src/
处理错误 安装如下包:
1、yum install epel-release 2、yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel安装Mysql-5.6.28
[root@bogon opt]# cd /usr/local/mysql/[root@bogon mysql]# grep mysql < /etc/passwd[root@bogon mysql]# useradd -M -s /sbin/nologin mysql [root@bogon mysql]# grep mysql < /etc/passwdmysql:x:500:500::/home/mysql:/sbin/nologin[root@bogon mysql]# chown -R mysql:mysql .[root@bogon mysql]# ll总用量 172drwxr-xr-x 2 mysql mysql 4096 12月 17 22:14 bin-rw-r--r-- 1 mysql mysql 17987 11月 16 17:38 COPYINGdrwxr-xr-x 3 mysql mysql 4096 12月 17 22:14 datadrwxr-xr-x 2 mysql mysql 4096 12月 17 22:14 docsdrwxr-xr-x 3 mysql mysql 4096 12月 17 22:14 include-rw-r--r-- 1 mysql mysql 105684 11月 16 18:45 INSTALL-BINARYdrwxr-xr-x 3 mysql mysql 4096 12月 17 22:14 libdrwxr-xr-x 4 mysql mysql 4096 12月 17 22:14 mandrwxr-xr-x 10 mysql mysql 4096 12月 17 22:14 mysql-test-rw-r--r-- 1 mysql mysql 2496 11月 16 17:38 READMEdrwxr-xr-x 2 mysql mysql 4096 12月 17 22:14 scriptsdrwxr-xr-x 28 mysql mysql 4096 12月 17 22:14 sharedrwxr-xr-x 4 mysql mysql 4096 12月 17 22:14 sql-benchdrwxr-xr-x 2 mysql mysql 4096 12月 17 22:14 support-files[root@bogon mysql]# mkdir -p /data/mysql[root@bogon mysql]# chown -R mysql:mysql /data/mysql/[root@bogon mysql]# ll /data/总用量 4drwxr-xr-x 2 mysql mysql 4096 12月 17 22:20 mysql[root@bogon mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory[root@bogon mysql]# yum install -y libaio*[root@bogon mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/[root@bogon mysql]# cp my.cnf /etc/my.cnf[root@bogon mysql]# vim /etc/my.cnf basedir = /usr/local/mysql datadir = /data/mysql port = 3306# server_id = ..... socket = /tmp/mysql.sock[root@bogon mysql]# cp support-files/mysql.server /etc/init.d/mysqld[root@bogon mysql]# vim /etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/data/mysql[root@bogon mysql]# chmod 755 !$chmod 755 /etc/init.d/mysqld[root@bogon mysql]# chkconfig --add !$chkconfig --add /etc/init.d/mysqld[root@bogon mysql]# chkconfig mysqld on[root@bogon mysql]# service mysqld startStarting MySQL.. SUCCESS![root@bogon mysql]# netstat -nlp | grep mysqldtcp 0 0 :::3306 :::* LISTEN 1949/mysqld unix 2 [ ACC ] STREAM LISTENING 21948 1949/mysqld /tmp/mysql.sock
安装Httpd
[root@bogon opt]# cd /usr/local/src/httpd-2.4.18/[root@bogon httpd-2.4.18]# ./configure --prefix=/usr/local/apache2/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=share --with-pcre
错误:
*-----------------------------------
1、configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.[root@bogon opt]# wget
[root@bogon opt]# wget [root@bogon opt]# tar jxvf apr-1.5.2.tar.bz2 [root@bogon opt]# tar jxvf apr-util-1.5.4.tar.bz2 [root@bogon opt]# cp -fr apr-1.5.2 /usr/local/src/httpd-2.4.18/srclib/apr [root@bogon opt]# cp -fr apr-util-1.5.4 /usr/local/src/httpd-2.4.18/srclib/apr-util/2、configure: error: pcre-config for libpcre not found. PCRE is required and available from
[root@bogon opt]# axel
[root@bogon opt]# tar jxvf pcre-8.37.tar.bz2 [root@bogon pcre-8.37]# ./configure && make && make install3、checking whether to enable mod_deflate… configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
[root@bogon httpd-2.4.18]# yum install zlib-devel -y
-----------------------------------***[root@bogon httpd-2.4.18]# ./configure --prefix=/usr/local/apache2/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=share --with-pcre[root@bogon httpd-2.4.18]# make[root@bogon httpd-2.4.18]# make install[root@bogon httpd-2.4.18]# /usr/local/apache2/bin/apachectl -tAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 221.192.153.43. Set the 'ServerName' directive globally to suppress this messageSyntax OK[root@bogon httpd-2.4.18]# /usr/local/apache2/bin/apachectl startAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 221.192.153.43. Set the 'ServerName' directive globally to suppress this message[root@bogon httpd-2.4.18]# netstat -nlp | grep httpdtcp 0 0 :::80 :::* LISTEN 62560/httpd [root@bogon httpd-2.4.18]# ps aux|grep httpdroot 62560 0.0 0.2 74408 2316 ? Ss 23:04 0:00 /usr/local/apache2//bin/httpd -k startdaemon 62561 0.2 0.4 418668 4200 ? Sl 23:04 0:00 /usr/local/apache2//bin/httpd -k startdaemon 62562 0.0 0.4 418668 4204 ? Sl 23:04 0:00 /usr/local/apache2//bin/httpd -k startdaemon 62563 0.0 0.4 418668 4208 ? Sl 23:04 0:00 /usr/local/apache2//bin/httpd -k startroot 62648 0.0 0.0 103316 896 pts/0 S+ 23:04 0:00 grep httpd[root@bogon httpd-2.4.18]# curl localhost -IHTTP/1.1 200 OKDate: Thu, 17 Dec 2015 15:08:10 GMTServer: Apache/2.4.18 (Unix)Last-Modified: Mon, 11 Jun 2007 18:53:14 GMTETag: "2d-432a5e4a73a80"Accept-Ranges: bytesContent-Length: 45Content-Type: text/html
安装PHP
[root@bogon opt]# cd /usr/local/src/php-5.6.3/
[root@bogon php-5.6.3]# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-bz2 –with-openssl –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-mbstring –enable-sockets –enable-exif –disable-ipv6 [root@bogon php-5.6.3]# make && make install [root@bogon htdocs]# cp php.ini-production /usr/local/php/etc/php.in [root@bogon htdocs]# cd /usr/local/apache2/conf/httpd.confAllowOverride none #Require all denied Order deny,allow Allow from all DirectoryIndex index.html index.htm index.php AddType application/x-compress .ZAddType application/x-gzip .gz .tgzAddType application/x-httpd-php .php
[root@bogon htdocs]# /usr/local/apache2/bin/apachectl -t
Syntax OK [root@bogon htdocs]# /usr/local/apache2/bin/apachectl restart测试:安装Discuz论坛
[root@bogon htdocs]# cd /usr/local/apache2/conf/httpd.conf# Virtual hostsInclude conf/extra/httpd-vhosts.conf[root@bogon ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf DocumentRoot "/tmp/tmp/ ServerName tmp.com DocumentRoot "/data/www/" ServerName www.test.com
[root@bogon ~]# mkdir /data/www
[root@bogon ~]# axel [root@bogon ~]# unzip Discuz_X3.2_SC_UTF8.zip [root@bogon ~]# mv upload/* /data/www/ [root@bogon ~]# /usr/local/mysql/bin/mysql -u root mysql> create database discuz; mysql> grant all on discuz.* to ‘ljj’@’localhost’ identified by ‘qwe123’; mysql> quit修改客户机的hosts,增加 192.168.2.2 www.test.com
浏览器访问www.test.com/install 安装Discuz!!