LAMP企业安装配置

1. 安装apache:
yum install apr-devel apr-util-devel -y
yum install gcc gcc-c++ autoconf automake -y
yum install bzip2 -y
cd /usr/src/

wget https://ftp.pcre.org/pub/pcre/pcre-8.00.tar.bz2
tar -xjvf pcre-8.00.tar.bz2
cd pcre-8.00
./configure
make
make install
cd ..

wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.38.tar.gz
tar xzf httpd-2.4.38.tar.gz
cd httpd-2.4.38
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite
make
make install
2.安装MySql:
yum install cmake ncurses-devel ncurses -y
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.5.20.tar.gz
tar -zxvf mysql-5.5.20.tar.gz
cd mysql-5.5.20
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql55 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all-DWITH_BIG_TABLES=1 -DWITH_DEBUG=0
make
make install
将源码安装的MySQL数据库服务设置为系统服务,可以使用chkconfig管理,并启动MySQL数据库:
cd /usr/local/mysql55
\cp support-files/my-large.cnf /etc/my.cnf
\cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
mkdir -p /data/mysql
useradd mysql
/usr/local/mysql55/scripts/mysql_install_db --user=mysql --datadir=/data/mysql/ --basedir=/usr/local/mysql55/
ln -s /usr/local/mysql55/bin/* /usr/bin/
service mysqld restart
3.安装php,php需与apache,MySQL整合:
yum install libxml2-devel libxml2 -y
cd /usr/src
wget http://mirrors.sohu.com/php/php-5.3.28.tar.bz2
tar xjf php-5.3.28.tar.bz2
cd php-5.3.28
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql55/
make
报错:/usr/local/src/php-5.3.28/Zend/zend_language_parser.h:317:
/usr/local/src/php5.3.28/Zend/zend_globals_macros.h:35
把zend_language_parser.h:317的int zendparse (void)改成int zendparse(void *compiler_globals),再次make
make install
4.Apache+PHP源码整合:
为了能让apache识别php文件,需将php安装完成后生成的libphp5.so模块与apache进行整合:
vim /usr/local/apache/conf/httpd.conf
添加如下代码:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html index.htm
5.测试apache+php环境:
cat >/usr/local/apache/htdocsindex.php<<EOF
<?php
phpinfo();
?>
EOF
重启apache: /usr/local/apache/bin/apachectl start

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message:
vi /usr/local/apache/conf/httpd.conf (根据自己安装的目录)
添加
#ServerName www.example.com:80
ServerName localhost:80

关闭防火墙:
systemctl stop firewalld.service
setenforce 0

6.Discuz论坛安装
cd /usr/src/
wget http://download.comsenz.com/DiscuzX/3.1/Discuz_X3.1_SC_UTF8.zip
unzip Discuz_X3.1_SC_UTF8.zip -d /usr/local/apache/htdocs/
cd /usr/local/apache/htdocs/ ;mv upload/* .
chmod 777 -R data/ uc_server/ config/ uc_client/
输入服务器ip,安装Discuz:
我同意---下一步---下一步---安装数据库----
mysql>create database discuz charset = utf8;
mysql>grant all on dizcuz.* to root@'localhost' identified by "123456";
----下一步
7.Redis安装:

wget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar -zxvf redis-2.8.13.tar.gz
cd redis-2.8.13
make MALLOC=libc PREFIX=/usr/local/redis install
cp redis.conf /usr/local/redis/
export PATH=/usr/local/redis/bin:$PATH
启动: nohup /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf &
停止: /usr/local/redis/bin/redis-cli -p 6379 shutdown

8.安装PHP-Redis连接驱动:

wget https://github.com/phpredis/phpredis/archive/3.1.2.tar.gz
tar xzf 3.1.2.tar.gz
cd phpredis-3.1.2/
/usr/local/php/bin/phpize #用phpize生成configure配置文件(根据php安装目录)
./configure --with-php-config=/usr/local/php5/bin/php-config --enable-redis
make
make install

vi /usr/local/php5/etc/php.ini
extension_dir="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626"
extension=redis.so

 

posted @ 2019-03-19 09:39  qcuser  阅读(231)  评论(0编辑  收藏  举报