Ubuntu 7.1 server从无到有搭建全能WEB生产环境(二)

http://www.dingl.com/blog/archives/13
作者:丁令

正式开始安装软件,这部分主要是mysql/apache的安装。

一、安装mysql
mysql使用utf-8作为默认编码:
 groupadd mysql
 useradd -g mysql mysql
 tar -zxvf mysql-5.0.45.tar.gz
 cd mysql-5.0.45
 ./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-collation=utf8_general_ci –with-extra-charsets=latin1
 make
 make install
 cp support-files/my-medium.cnf /etc/my.cnf
 cd /usr/local/mysql
 bin/mysql_install_db –user=mysql
 chown -R root .
 chown -R mysql var
 chgrp -R mysql .
 bin/mysqld_safe –user=mysql &

将mysql加入PATH:
 vi /etc/profile
增加:
 PATH=/usr/local/mysql/bin:”${PATH}”

让mysql随系统一起启动
 cp support-files/mysql.server /etc/init.d/mysqld
 cd /etc/init.d
 update-rc.d mysqld defaults

重启服务器,验证mysql是否能随系统正常启动,启动后:
 mysql
如果能直接进入则说明启动成功。
为了安全,修改root密码:
 mysql>use mysql
 mysql>UPDATE user SET password=PASSWORD(’new_password’) WHERE user=’root’;
 mysql>FLUSH PRIVILEGES;
 mysql>exit

二、安装apache
1、安装apache前,先安装openssl,因为后面要配置apache支持https协议:
 tar -zxvf openssl-0.9.8e.tar.gz
 cd openssl-0.9.8e
 ./config –prefix=/usr/local/ssl
 make
 make test
 make install

2、安装apache,configure参数可根据需要调整。
 tar -zxvf httpd-2.2.6.tar.gz
 cd httpd-2.2.6
 ./configure –prefix=/usr/local/apache –enable-modules=all –enable-rewrite –enable-forward –enable-ssl –with-ssl=/usr/local/ssl –enable-mods-shared=all –enable-deflate –enable-proxy –enable-proxy-balancer –enable-proxy-http
 make
 make install
修改conf/httpd.conf的ServerName:
 ServerName 127.0.0.1:80

测试apache是否正常

让apache随系统一起启动
 cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
 cd /etc/init.d
 update-rc.d httpd defaults

]]>

© 版权声明
THE END
喜欢就支持以下吧
点赞0
分享