软件包:httpd-2.4.37.tar.gz apr-1.6.5.tar.gz apr-util-1.6.1.tar.gz
mysql-5.5.32.tar.gz cmake-2.8.8.tar.gz
php-5.6.38.tar.gz
Discuz_SC_GBK.zip
1、apache源码安装
点击(此处)折叠或打开
-
关闭防火墙
-
iptables -F
-
chkconfig iptables off
-
mkdir /tmp/lamp
-
cd /tmp/lamp
-
yum install apr apr-util apr-devel apr-util-devel -y
-
tar -zxvf httpd-2.4.37.tar.gz
- cd httpd-2.4.37
-
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-rewrite --enable-so
-
---------------------------如果编译报以下错误----------------------------------
-
checking for APR... configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9
-
configure:
-
-
WARNING: skipped APR at apr-1-config, version not acceptable
-
no
-
configure: error: APR not found. ?Please read
-
- the documentation.
-
-------------------------需要更新apr apr-util版本到1.4以上---------------------
-
tar -zxvf apr-1.6.5.tar.gz -C /tmp/lamp/httpd-2.4.37/srclib/
-
tar -zxvf apr-util-1.6.1.tar.gz -C /tmp/lamp/httpd-2.4.37/srclib/
-
cd /tmp/lamp/httpd-2.4.37/srclib
-
mv apr-1.6.5 apr
-
mv apr-util-1.6.1 apr-util
-
-------------------------------------------------------------------------------
-
在进行编译:
-
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-rewrite --enable-so
-
-----------------------又出现pcre-config报错----------------------------------
-
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
- ---------------------------------安装pcre-devel即可------------------------------------
-
yum -y install pcre-devel
- 或
- wget -P /tmp/lamp ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
- tar -zxvf pcre-8.38.tar.gz
- ./configure --prefix=/usr/local/pcre
- 配置pcre过程C++报错
- configure: error: You need a C++ compiler for C++ support.
-
安装gcc-c++
-
yum -y install gcc-c++
- 在编译pcre
-
./configure --prefix=/usr/local/pcre
-
make
-
make install
- --------------------------------------------------------------------------------------
-
在重新进行编译:
-
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-rewrite --enable-so
-
make
-
make install
- ---------------------------------------apache安装完毕-------------------------------
2、mysql源码安装
点击(此处)折叠或打开
-
cd /tmp/lamp
-
安装cmake
-
tar xf cmake-2.8.8.tar.gz
-
cd cmake-2.8.8
-
./configure
-
gmake
-
gmake install
-
安装依赖包
-
yum install ncurses-devel -y
-
创建用户和组
-
groupadd mysql
-
添加mysql用户 指定不能用来登录;
-
useradd mysql -s /sbin/nologin -M -g mysql
-
tar -zxvf mysql-5.5.32.tar.gz
-
cd mysql-5.5.32
-
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 \
-
-DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data \
-
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock \
-
-DDEFAULT_CHARSET=utf8 \
-
-DDEFAULT_COLLATION=utf8_general_ci \
-
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-
-DENABLED_LOCAL_INFILE=ON \
-
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-
-DWITH_FAST_MUTEXES=1 \
-
-DWITH_ZLIB=bundled \
-
-DENABLED_LOCAL_INFILE=1 \
-
-DWITH_READLINE=1 \
-
-DWITH_EMBEDDED_SERVER=1 \
-
-DWITH_DEBUG=0
-
-
make
-
make install
-
ln -s /usr/local/mysql-5.5.32 /usr/local/mysql
-
cd /usr/local/mysql/support-files
-
cp my-small.cnf /etc/my.cnf
-
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
-
tail -1 /etc/profile
-
source /etc/profile
-
cd /usr/local/
-
chown -R mysql.mysql mysql/
-
防止/tmp下文件被非所有者删除
-
chmod -R 1777 /tmp/
-
cd mysql/scripts/
-
mysql初始化
-
./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql
-
cd ../support-files/
-
cp mysql.server /etc/init.d/mysqld
-
chmod +x /etc/init.d/mysqld
-
/etc/init.d/mysqld start
-
netstat -nltup|grep 3306
-
chkconfig mysqld on
-
chkconfig --list mysqld
-
清理一些不必要的库和user信息
-
mysql
-
mysql> select user,host from mysql.user;
-
+------+-------------+
-
| user | host |
-
+------+-------------+
-
| root | 127.0.0.1 |
-
| root | ::1 |
-
| | localhost |
-
| root | localhost |
-
| | songhyunmin |
-
| root | songhyunmin |
-
+------+-------------+
-
6 rows in set (0.00 sec)
-
mysql> delete from mysql.user where user=''
-
mysql> delete from mysql.user where host='songhyunmin';
-
mysql> delete from mysql.user where host='::1';
-
mysql> select user,host from mysql.user;
-
+------+-----------+
-
| user | host |
-
+------+-----------+
-
| root | 127.0.0.1 |
-
| root | localhost |
-
+------+-----------+
-
2 rows in set (0.00 sec)
-
mysql> show databases;
-
+--------------------+
-
| Database |
-
+--------------------+
-
| information_schema |
-
| mysql |
-
| performance_schema |
-
| test |
-
+--------------------+
-
4 rows in set (0.00 sec)
-
mysql> drop database test;
-
Query OK, 0 rows affected (0.00 sec)
-
-
mysql> show databases;
-
+--------------------+
-
| Database |
-
+--------------------+
-
| information_schema |
-
| mysql |
-
| performance_schema |
-
+--------------------+
-
3 rows in set (0.00 sec)
-
创建密码
-
mysqladmin -uroot password '123456'
-
mysql -uroot -p123456
-
查看系统字符集
-
cat /etc/sysconfig/i18n
-
LANG="zh_CN.UTF-8"
- ----------------------------------mysql安装完毕----------------------------------------
点击(此处)折叠或打开
-
cd /tmp/lamp/
-
tar -zxvf php-5.6.38.tar.gz
-
cd php-5.6.38
-
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php/etc --with-
-
-
apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
-
--------------------------------------报错---------------------------------
-
configure: error: xml2-config not found. Please check your libxml2 installation.
-
---------------------------安装libxml2 libxml2-devel-------------------------
-
yum install libxml2 libxml2-devel -y
-
在重新配置
-
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php/etc --with-
-
-
apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
-
make
-
make install
-
-
整合apache+php环境,修改/usr/local/apache2/conf/httpd.conf
-
修改
-
ServerName localhost:80
-
添加
-
AddType application/x-httpd-php .php
-
DirectoryIndex index.php index.html
-
-
编译index.php配置文件
-
cat >> /usr/local/apache2/htdocs/index.php << EOF
-
php
-
phpinfo();
-
?>
-
EOF
-
启动apache
- /usr/local/apache2/bin/apachectl start
-
4、安装discuz
点击(此处)折叠或打开
-
cd /tmp/lamp
-
unzip Discuz_SC_GBK.zip -d /usr/local/apache2/htdocs/
-
cd /usr/local/apache2/htdocs/
-
mv dir_SC_GBK/upload/* .
-
chmod -R 777 data/ uc_server/ config/ uc_client/
-
/usr/local/apache2/bin/apachectl restart
-
创建discuz数据库
-
mysql -uroot -p123456
-
mysql> create database discuz;
- mysql> grant all on discuz.* to discuz@'localhost' identified by '123456'
-