Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2259029
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: LINUX

2011-03-28 09:18:08

一、apache的搭建
1、查看是否包含gcc软件包
yum -y install openssl-devel gcc gcc-c++
yum install gcc*
rpm -q gcc
cd /usr/local/src
tar zxvf httpd-2.2.9
cd http-2.2.9
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl
make
make install
藏和伪装apache的版本:
vim include/ap_release.h +44
将:
#define AP_SERVER_BASEPRODUCT "Apache"
修改为:
#define AP_SERVER_BASEPRODUCT "Microsoft-IIS/6.0\"
另外修改这些选项:

#define AP_SERVER_BASEVENDOR “Apache Software Foundation”
#define AP_SERVER_BASEPROJECT “Apache HTTP Server”
#define AP_SERVER_BASEPRODUCT “Apache”

#define AP_SERVER_MAJORVERSION_NUMBER 2
#define AP_SERVER_MINORVERSION_NUMBER 2
#define AP_SERVER_PATCHLEVEL_NUMBER 15
#define AP_SERVER_DEVBUILD_BOOLEAN 0


vim os/unix/os.h +35
将:
#define PLATFORM "Unix"
修改为:
#define PLATFORM "Win32"
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl
make
make install
vim /usr/local/apache2/conf/http.conf +41
添加如下项目:
Listen 80(在这行下面添加)
ServerSignature Off
ServerTokens Prod

二、mysql的搭建
yum install gcc*
yum install ncurses-dev*
groupadd mysql
useradd -g mysql mysql
mkdir /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
tar zxvf mysql-5.1.55
cd mysql-5.1.55
./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql
make
make install
/usr/local/mysql/bin/mysql_install_db
chown -R mysql /var/lib/mysql
cp /usr/local/src/mysql-5.1.55/support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysqladmin -u root -p password '123456'
登录mysql试试:
/usr/local/mysql/bin/mysql -u root -p
三、php包含gd库的搭建
1、以root身份登录Linux主机;(权限不够,给相应权限)
2、停止Web Server服务,如果使用的是Apache可以通过以下命令停止:
shell> /usr/local/apache2/bin/apachectl stop
3、卸载当前PHP(为了安全起见最好先更改目录名称):
shell> rm -rf /usr/local/php
shell> rm -rf /usr/local/Zend
shell> vi /usr/local/apache2/conf/httpd.conf
找到LoadModule phpX_module modules/libphpX.so
其中X是PHP版本(4或者5)一行,并将此行删除,保存退出
4、下载安装GD库需要的相关安装包:
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
mkdir /usr/local/jpeg6/bin/
mkdir -p /usr/local/jpeg6/bin/cjpeg
安裝jpeg-6b
cp   /usr/share/libtool/config.*  /usr/local/src/jpeg-6b/
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
make
make install
 
5、安裝 freetype
tar zxvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure  --prefix=/usr/local/freetype
make
make install
7、安裝 zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib
cd 1.2.3
./configure
make
make install
6、安裝 libpng
tar zxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure --prefix=/usr/local/libpng
make
make install



8、下载安装GD库安装包:
shell> cd /usr/local/src
shell> tar xzvf gd-2.0.33.tar.gz
shell> cd gd-2.0.33.tar.gz
shell> ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png-dir=/usr/local/libpng --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install
 
yum install php-gd gd
 
9、下载PHP 5.3.5:
首先
 yum install libxml*
yum install bzip*
yum install libpng*

shell> cd /usr/local/src
shell> tar xzvf php-5.3.5.tar.gz
shell> cd php-5.3.5
shell> ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir --with-ttf --enable-mbstring --disable-ipv6 --enable-trace-vars
shell> make clean
shell> make
shell> make install
cp /usr/local/src/php-5.3.5/php.ini-production /usr/local/php5/lib/php.ini
安装并重新启动Apache服务后,可以创建phpinfo.php文件检查GD库的支持情况



10、经测试,现在已经好用了,但是我在加几个步骤:
vim /usr/local/php5/lib/php.ini
把#号去掉:  extension=msql.so
vim /usr/local/apache2/conf/httpd.conf
找到:  LoadModule php5_module modules/libphp5.so
在下面加入: 
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
修改: DirectoryIndex index.html
为:   DirectoryIndex index.php index.phps index.html
保存退出
vim /usr/local/php5/lib/php.ini +431
修改:
expose_php = On
为:
expose_php = Off
/usr/local/apache2/bin/apachectl restart
11、如果还不行,就在/usr/local/php5/php.ini文件中找到db的相关字,把前面的#去掉。
3、1测试php连接mysql
vim /usr/local/apache2/htdocs/aaa.php
$link=mysql_connect("localhost","root","123456");
if(!$link) echo "FAILD!";
else echo "OK!";
?>
4、phpmyadmin的搭建
tar zxvf phpmyadmin-3.3.5
cp phpmyadmin-3.3.5 /usr/local/apach2/htdocs/
mv phpmyadmin-3.3.5 phpmyadmin
即可访问
5、svn独立模式的搭建
tar zxvf subversion-1.4.0.tar.gz
tar zxvf subversion-deps-1.4.0.tar.gz
cd subversion-1.4.0
./configure --prefix=/opt/svn --without-verkeley-db --with-zlib
make clean
make
make install
vi /etc/profile,在/etc/profile最后加入:
    PATH=$PATH:/opt/svn/bin
    export PATH
mkdir -p /opt/svndata/repos1
mkdir -p /opt/svndata/repos2
svnadmin create /opt/svndata/repos1
svnadmin create /opt/svndata/repos2
cp /opt/svndata/repos1/conf/svnserve.conf /opt/svndata/repos1/conf/svnserve.conf.bak
vi /opt/svndata/repos1/conf/svnserve.conf
[general]
    anon-access = none
    auth-access = write
    password-db = /opt/svn/conf/pwd.conf
    authz-db = /opt/svn/conf/authz.conf
    realm = repos1
版本库二:
vi /opt/svndata/repos2/conf/svnserve.conf
[general]
    anon-access = none
    auth-access = write
    password-db = /opt/svn/conf/pwd.conf
    authz-db = /opt/svn/conf/authz.conf
    realm = repos2
配置允许访问的svn用户vi /opt/svn/conf/pwd.conf
[users]
alan = password
king = hello
liuyi = www.163.com
jiangtao = 123456
dalian = 123456
yuanpeng = asdf123
zhengdi = zd790303
wangyang = wangyang123456
wangqiu = taotao0608
fengguangping = fgp1003
sunlibo = 08067416
lijian = dlhuarenshixian111
shaoyuxiang = shaoyu
jiangshiyao = ciyyao
zhangzuozhen = Zhangzz
liuxingwei = lxw02162011
wangqian = 123321
liuming = htc3380
wanghai = 123456
tianjiahui = 123
wangjiafu = 123456
donghaizhen = 123456
root = rootroot
zhengyi = 123456
wangyushi = 123456
配置svn用户访问权限vi /opt/svn/conf/authz.conf
[groups]
admin = alan,liuyi,jiangyao,king,jiangtao,dalian,yuanpeng,zhengdi,wangyang,wangqiu,fengguangping,sunlibo,lijian,shaoyuxiang,jiangshiyao,zhangzuozhen,liuxingwei,wangqian,liuming,tianjiahui,wanghai,wangjiafu,donghaizhen,root,zhengyi,wangyushi,
[/]
@admin = rw
[repos1:/abc/aaa]
king = rw
[repos2:/pass]
king =
svn配置完毕,删除无用文件rm /opt/svndata/repos1/conf/authz
    rm /opt/svndata/repos1/conf/passwd
    rm /opt/svndata/repos2/conf/authz
    rm /opt/svndata/repos2/conf/passwd
    3. 启动svn建立启动svn的用户useradd svn
    passwd svn
允许用户svn访问版本库chown -R svn:svn /opt/svndata
    chown -R svn:svn /opt/svn
启动svn:
svnserve -d -r /opt/svndata
检查:
    ps -ef|grep svnserve
注释:仓库可以copy,但是copy之后不许的话,用命令:svn update!!
svn仓库迁移
scp -r root:192.168.0.233/opt/svndata/repos1 /opt/svndata/
svn update
chown -R svnroot:svnroot ./仓库   :把仓库的所有者和所有组都归svnroot所有。
6、开机自动启动
vi /etc/rc.d/rc.local
/usr/local/apache2/bin/apachectl start
svnserve -d -r /opt/svndata
service sshd start
/usr/local/mysql/bin/mysqld_safe &
7、hooks程序
二、hooks程序
cd 到相应仓库的hooks目录下:
cd /opt/svndata/development/hooks
vi post-commit
#!/bin/sh
export lang=en_US.UTF-8
export LC_ALL=en_US.UTF-8
SVN=/opt/svn/bin/svn
WEB=/www/cmstest
$SVN up --username root --password rootroot $WEB
阅读(1378) | 评论(0) | 转发(0) |
0

上一篇:完全权限samba、ftp

下一篇:新建svn账户

给主人留下些什么吧!~~