首页 > 代码库 > 亚马逊免费服务器搭建Discuz!论坛过程(三)
亚马逊免费服务器搭建Discuz!论坛过程(三)
参考文章:http://faq.comsenz.com/library/system/env/env_linux.htm
参考但是不要完全按照上述文章,不然很可能出错。
尤其不要init 6 重启,我重启之后造成实例启动失败,只能重新创建了实例。
1:下载
在 /usr/local/src 目录下执行下面两个命令,下载 lamp_tools.list 及该列表中的程序:
wget http://c.sihost.net/lamp_tools.list
wget -i lamp_tools.list
下载所需的程序安装包
其中cmake 2.8.5 下载失败,需要自己找源下载。
我随便搜了个,亲测可用: wget http://down1.chinaunix.net/distfiles/cmake-2.8.5.tar.gz
在安装cmake 之前,需要安装C/C++的编译器gcc和g++
yum install gcc
yum install gcc-c++ libstdc++-devel
2:安装
cd /usr/local/src
tar zxvf cmake-2.8.5.tar.gz
cd cmake-2.8.5/
./configure
gmake &&gmake install
groupadd mysql
useradd -g mysql mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
cd /usr/local/src
tar zxvf mysql-5.5.28.tar.gz
cd mysql-5.5.28
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Comsenz/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/usr/local/Comsenz/etc/ -DWITH_BLACKHOLE_STORAGE_ENGINE=1
如果上述命令出现错误:— Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
则: mv CMakeCache.txt CMakeCacheold.txt
yum install ncurses-devel
make && make install
编译安装 PHP 所需的支持库
cd /usr/local/Comsenz/mysql
./scripts/mysql_install_db --user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 3 mysqld on
编辑 /etc/rc.d/init.d/mysqld,找到
basedir=
datadir=
改成
basedir=/usr/local/Comsenz/mysql
datadir=/data/mysql
然后在 Comsenz 目录下创建 etc 目录,并将 MySQL 配置文件拷贝到该目录下:
mkdir -p /usr/local/Comsenz/etc
cp ./support-files/my-huge.cnf /usr/local/Comsenz/etc/my.cnf
编辑配置文件 /usr/local/Comsenz/etc/my.cnf,在 [mysqld] 段增加
datadir = /data/mysql
wait-timeout = 10
max_connections = 512
max_connect_errors = 10000000
local-infile=0
在 [mysqld] 段修改
max_allowed_packet = 16M
thread_cache_size = CPU个数*2
将 log-bin 注释
mv /usr/local/Comsenz/mysql/data/* /data/mysql
service mysqld start
bin/mysqladmin -u root password ‘admin999‘
其中 admin999 是要设置的 root 密码。
编译安装 PHP 所需的支持库
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure --prefix=/usr/local
make && make install
cd /usr/local/src/
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
cd /usr/local/src/
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make && make install
cd /usr/local/src/
64bit 系统执行下面的:
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig
./configure
make && make install
编译安装PHP
cd /usr/local/src
tar zxvf php-5.2.17.tar.gz
cd php-5.2.17
./configure --prefix=/usr/local/Comsenz/php5 --with-config-file-path=/usr/local/Comsenz/etc --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --enable-magic-quotes --with-mysql=/usr/local/Comsenz/mysql --with-pear --enable-sockets --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --with-zlib --enable-sysvsem --enable-exif --enable-sysvshm --with-libxml-dir=/usr --with-apxs2=/usr/local/Comsenz/apache/bin/apxs --with-iconv=/usr/local/libiconv --with-iconv-dir=/usr/local --with-xmlrpc --enable-xml --enable-shmop --enable-zip --with-mhash --with-mcrypt --enable-discard-path --enable-bcmath --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --with-openssl
如果出现以下错误:
那么vi /usr/local/Comsenz/apache/bin/apxs,
将第一行
#!/replace/with/path/to/perl/interpreter -w
替换为
#!/usr/bin/perl -w
亚马逊免费服务器搭建Discuz!论坛过程(三)