TS服务器安装(APACHE+MYSQL+python)
时间:2007-09-03 来源:sztzy
echo on
cd root/aa
echo -----apache is installing------
tar xvfj httpd-2.0.55.tar.bz2
sleep 10
cd httpd-2.0.55
./configure --prefix=/usr/local/apache2 --enable-module=so
make;make install
sleep 70
cp -r /root/aa/trackerserver/ /usr/local/apache2/htdocs/ 《mysql的安装》
echo ----mysql is installing----
cd /root/aa
tar xvfz mysql-max-5.0.18-linux-i686-glibc23.tar.gz
sleep 20
groupadd mysql
useradd -g mysql mysql
mv mysql-max-5.0.18-linux-i686-glibc23 /usr/local
cd /usr/local
ln -s mysql-max-5.0.18-linux-i686-glibc23 mysql
cd mysql
chown -R root .
chown -R root data
chgrp -R root .
cd support-files
cp my-huge.cnf /etc/my.cnf
cp mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
cd /usr/lib
rm -rf /usr/lib/mysql/
ln -s /usr/local/mysql/lib/ mysql
cd /usr/include
rm -rf mysql
ln -s /usr/local/mysql/include/ mysql
cd /usr/local/mysql/
./scripts/mysql_install_db --user=root (安装数据库)
bin/safe_mysqld --user=root & (启动数据库)
cd /usr/local/mysql/bin
./mysqladmin -u root -p password '00720606' (修改root密码)
echo please use this command " bin/mysqladmin -u root -p password '00720606' "to change the password of mysql.
sleep 6
cd /usr/local/mysql
echo use 'bin/mysql -u root-p </root/aa/ts.sql'command to load ts.sql databases (导入数据库脚本) 《python模块安装》
echo -------mod-python is installing----------
cd /root/aa/
tar xvfz mod_python-3.2.8.tgz
sleep 5
cd mod_python-3.2.8
./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache2/bin/apxs
make;make install
cd /use/bin/
ln -s /usr/local/mysql/bin/* .
export PATH=/usr/local/mysql/bin:$PATH
echo ----------mysql-python is installing---------
cd /root/aa
tar xvfz MySQL-python-1.2.1_p2.tar.gz
sleep 5
cd MySQL-python-1.2.1_p2
python setup.py install
脚本启动注意:需要在/root下新建一个目录aa,然后把需要安装的文件拷贝(httpd-2.0.55.tar.bz2,mod_python-3.2.8.tgz,mysql-max-5.0.18-linux-i686-glibc23.tar.gz,MySQL-python-1.2.1_p2.tar.gz,ts.sql,trackerserver目录,安装脚本setup.sh)到aa下。然后增加setup.sh的执行属性,命令为:#chmod +x setup.sh
然后运行脚本,脚本结束后,开始以下配置。
1 Mysql的启动(脚本已经自动启动)
#cd /usr/local/mysql/bin/
#./scripts/mysql_install_db --user=root
#./safe_mysqld --user=root &
2更改mysql root密码
#cd /usr/local/mysql/bin/
#./mysqladmin –u root –p password ‘00720606’,然后回车。输入00720606回车。
3 倒入ts数据库
#cd /usr/local/mysql/bin/
#./mysql -u root –p</root/aa/ts.sql
输入密码:00720606
4配置apache服务器
#cd /usr/local/apache2/conf
#vi httpd.conf
在此文件末尾加上
LoadModule python_module modules/mod_python.so
<Directory "/usr/local/apache2/htdocs/trackerserver">
AddHandler mod_python .psp
PythonHandler mod_python.psp
</Directory>
把第219行的 Listen 80 更改为 Listen 8222
把第502行的CustomLog logs/access_log common更改为#CustomLog logs/access_log common
存盘退出。存盘命令:wq
5 apache运行
#cd /usr/local/apache2/bin/
#./httpd –k start
6服务器配置安装完成
Ts的ip是本机ip.端口为8222
访问日志拒绝填写。
Mysql端口为3306。