mysql安装:
[root@wangchao ~]# cd /usr/local/src/ //下载的包都放到该目录下
[root@wangchaosrc]#wget http://www.lishiming.net/data/attachment/forum/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[root@wangchao src]# du -sh mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
118M mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
[root@wangchao src]# tar zxvf mysql-5.1.40-linux-i686-icc-glibc23.tar.gz //解压缩
[root@wangchao src]# ls
[root@wangchao src]# useradd -s /sbin/nologin -M mysql
//添加mysql用户,――M 无家目录
[root@wangchao src]# ls /home/
tom
[root@wangchao src]# mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql
//安装地移到/usr/local/mysql下
[root@wangchao src]# ls /usr/local/mysql/
[root@wangchao src]# cd /usr/local/mysql/
[root@wangchao mysql]# ls
[root@wangchao mysql]# mkdir -p /data/mysql //创存放数据目录
[root@wangchao mysql]# chown -R mysql /data/mysql/ //改主为mysql,不然无权限访问
[root@wangchao mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
//安装--user=mysql指定用户mysql,--datadir=/data/mysql指定存放数据目录
[root@wangchao mysql]# echo $?
0
[root@wangchao mysql]# cd support-files/
[root@wangchao support-files]# ls
[root@wangchao support-files]# ls /etc/my.cnf //mysql的配置文件
/etc/my.cnf
[root@wangchao support-files]# cp my-large.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@wangchao support-files]# vim !$
[root@wangchao support-files]# ls /etc/init.d/ //系统服务项
[root@wangchao support-files]# cp mysql.server /etc/init.d/mysqld
//拷贝脚本到系统服务项
[root@wangchao support-files]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
[root@wangchao support-files]# chkconfig --add mysqld //加入服务系统列表
[root@wangchao support-files]# chkconfig mysqld on
[root@wangchao support-files]# /etc/init.d/mysqld start //启动mysql
Starting MySQL [ OK ]
[root@wangchao support-files]# ps aux |grep mysql
root 2210 0.0 0.1 3044 1256 pts/0 S Jun08 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/wangchao.pid
mysql 2321 0.0 4.2 381624 43676 pts/0 Sl Jun08 0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --log-error=/data/mysql/wangchao.err --pid-file=/data/mysql/wangchao.pid --socket=/tmp/mysql.sock --port=3306
root 3811 0.0 0.0 4352 716 pts/1 S+ 01:06 0:00 grep mysql
[root@wangchao support-files]# netstat -lnp |grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2321/mysqld
unix 2 [ ACC ] STREAM LISTENING 20761 2321/mysqld /tmp/mysql.sock
//ps aux |grep mysql 查看进程mysql启动
//netstat -lnp |grep mysql 查看mysql端口监听(3306)
Apache编译安装
[root@wangchao support-files]# cd /usr/local/src/
[root@wangchao src]# ls
[root@wangchaosrc]#wget http://www.lishiming.net/data/attachment/forum/httpd-2.2.24.tar.bz2
[root@wangchao src]# tar jxvf httpd-2.2.24.tar.bz2
[root@wangchao src]# cd httpd-2.2.24
[root@wangchao httpd-2.2.24]# ls
[root@wangchao httpd-2.2.24]# vim INSTALL //可查看编译步骤
[root@wangchao httpd-2.2.24]# ./configure \
> --prefix=/usr/local/apache2 \
> --with-included-apr \
> --enable-so \
> --enable-deflate=shared \
> --enable-expires=shared \
> --enable-rewrite=shared \
> --with-pcre
[root@wangchao httpd-2.2.24]# echo $?
0
[root@wangchao httpd-2.2.24]# make
[root@wangchao httpd-2.2.24]# echo $?
0
[root@wangchao httpd-2.2.24]# make install
[root@wangchao httpd-2.2.24]# echo $?
0
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl start //启动之
[root@wangchao httpd-2.2.24]# ps aux |grep httpd
[root@wangchao httpd-2.2.24]# netstat -lnp|grep "httpd"
tcp 0 0 :::80 :::* LISTEN 20842/httpd
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl -M
//列出apache的模块
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl -t
//检查apache文件有无语法错误
[root@wangchao httpd-2.2.24]# ls /usr/local/apache2/conf/httpd.conf //apache的配置文件
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl restart //重启
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl stop //关闭
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl start //启动
[root@wangchao httpd-2.2.24]# /usr/local/apache2/bin/apachectl graceful
//重新加载配置文件,不杀死进程
php编译安装
[root@wangchao httpd-2.2.24]# cd /usr/local/src/
[root@wangchao src]# wget http://am1.php.net/distributions/php-5.3.27.tar.gz
[root@wangchao src]# tar zxvf php-5.3.27.tar.gz
[root@wangchao src]# cd php-5.3.27
配置编译参数
[root@wangchao php-5.3.27]# ./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
报错
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[[email protected]]#rpm-ivh 'www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm'
如果是64位系统
rpm -ivh 'http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm '
[root@wangchao php-5.3.27]# yum list |grep -i mcrypt
[root@wangchao php-5.3.27]# yum install -y libmcrypt-devel
其它报错解决方法试试:
[root@wangchao php-5.3.27]# yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel
[root@wangchao php-5.3.27]# rm -f /var/run/yum.pid
编译安装
[root@wangchao php-5.3.27]# make
[root@wangchao php-5.3.27]# echo $?
0
[root@wangchao php-5.3.27]# make install
[root@wangchao php-5.3.27]# echo $?
0
[root@wangchao php-5.3.27]# ls /usr/local/apache2/modules/
libphp5.so
[root@wangchao php-5.3.27]# /usr/local/php/bin/php -m
[root@wangchao php-5.3.27]# /usr/local/php/bin/php -i
测试PHP解析
[root@wangchao ~]# /usr/local/apache2/bin/apachectl -M
[root@wangchao ~]# /usr/local/apache2/bin/apachectl restart
ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:47:DF:59
inet addr:192.168.137.22 Bcast:192.168.137.255 Mask:255.255.255.0
[root@wangchao ~]# setenforce 0
[root@wangchao ~]# service iptables stop
电脑访问:
[root@wangchao ~]# vim /usr/local/apache2/conf/httpd.conf
//查看配置文件部分解释如下:
ServerRoot "/usr/local/apache2" //安装的目录
Listen 80 //监听的端口
LoadModule deflate_module modules/mod_deflate.so //加载的模块
User daemon //以哪个用户运行的
Group daemon
ServerAdmin [email protected] //管理员邮箱
DocumentRoot "/usr/local/apache2/htdocs" //网页存放目录
[root@wangchao ~]# cd /usr/local/apache2/htdocs/
[root@wangchao htdocs]# ls
index.html
[root@wangchao htdocs]# vim 1.txt
121212
[root@wangchao htdocs]# cat 1.txt
121212
[root@wangchao htdocs]# vim 2.php
<?php
echo 1111;
?>
//这不是我们想要的结果,想要PHP能够解析显示1111
[root@wangchao htdocs]# /usr/local/php/bin/php 2.php //以下输出才是想要的
1111
[root@wangchao htdocs]# vim /usr/local/apache2/conf/httpd.conf //编辑该文件
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php //添加该行
<IfModule dir_module>
DirectoryIndex index.html index.php //添加index.php
</IfModule>
#ServerName www.example.com:80
ServerName localhost:80 //修改成这样
[root@wangchao htdocs]# /usr/local/apache2/bin/apachectl -t
Syntax OK
//检测配置文件有无语法错误
[root@wangchao htdocs]# /usr/local/apache2/bin/apachectl graceful //重新加载
[root@wangchao htdocs]# ls
1.txt 2.php index.html
[root@wangchao htdocs]# vim info.php
<?php
phpinfo ();
?>
[root@wangchao htdocs]# /usr/local/php/bin/php -i|less //显示的内容与上一致
[root@wangchao htdocs]# cat /usr/local/apache2/build/config.nice
#! /bin/sh
#
# Created by configure
"./configure" \
"--prefix=/usr/local/apache2" \
"--with-included-apr" \
"--enable-so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--with-pcre" \
"$@"
//查看之前编译的配置参数
[root@wangchao htdocs]# cp /usr/local/src/php-5.3.27/php.ini-production /usr/local/php/etc/php.ini
[root@wangchao ~]# /usr/local/apache2/bin/apachectl graceful
//刚刚的操作改了第五个格子,文件的路径加上了
不用以上IP访问,也可用curl测试:
[root@wangchao ~]# curl 192.168.137.22/info.php
[root@wangchao ~]# curl 192.168.137.22/1.txt
121212
安装discuz!
[root@wangchao ~]# mkdir /data/www
[root@wangchao ~]# cd /data/www/
[root@wangchaowww]#wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
[root@wangchao www]# unzip Discuz_X3.2_SC_GBK.zip
[root@wangchao www]# ls
Discuz_X3.2_SC_GBK.zip readme upload utility
[root@wangchao www]# mv upload/* ./
[root@wangchao www]# ls
[root@wangchao www]# rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip
[root@wangchao www]# ls
[root@wangchao www]# ps aux | grep httpd
[root@wangchao www]# vim /usr/local/apache2/conf/httpd.conf
#Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-vhosts.conf //打开虚拟主机配置(去掉前面#注释)
[root@wangchao www]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/usr/local/apache2/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
改成:
<VirtualHost *:80>
# ServerAdmin [email protected]
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.aaa.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
[root@wangchao www]# /usr/local/apache2/bin/apachectl -t
Warning: DocumentRoot [/usr/local/apache2/docs/dummy-host2.example.com] does not exist
Syntax OK
[root@wangchao www]# /usr/local/apache2/bin/apachectl restart
windows客户端:
C:\Windows\System32\drivers\etc下hosts文件添加最后两行如下:
192.168.137.22 www.test.com
192.168.137.22 www.aaa.com
[root@wangchao www]# vim /usr/local/apache2/conf/httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
改成:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
[root@wangchao www]# /usr/local/apache2/bin/apachectl -t
[root@wangchao www]# /usr/local/apache2/bin/apachectl restart
windows浏览器输入:www.test.com。开始安装如下:
[root@wangchao www]# ps aux |grep http
root 2196 0.0 1.1 27200 11616 ? Ss 04:41 0:01 /usr/local/apache2/bin/httpd -k start
daemon 3398 0.0 0.9 27332 10156 ? S 07:30 0:00 /usr/local/apache2/bin/httpd -k start
[root@wangchao www]# ls -l
[root@wangchao www]# chown -R daemon config/ data/ uc_client/data/ uc_server/data/
全新安装
[root@wangchao www]# /usr/local/mysql/bin/mysql
[root@wangchao www]# which $PATH
[root@wangchao www]# which mysql
[root@wangchao www]# vim /etc/profile.d/path.sh
export PATH=$PATH:/usr/local/mysql/bin
[root@wangchao www]# source !$
source /etc/profile.d/path.sh
[root@wangchao www]# mysql
mysql> quit
Bye
[root@wangchao www]# mysql
mysql> create database discuz;
mysql> grant all on discuz.* to 'aming'@'localhost' identified by 'aminglinux';
mysql> quit
下一步安装
安装完成可点右下角您的论坛已完成安装,点此访问访问