FreeBSD 8.0搭建nginx+jexus+php+asp.net+mysql脚本

  前几天安装FreeBSD 8.0 Web服务器环境的时候写的一个脚本,已经在FreeBSD 8.0下测试通过,不过不是一键安装,大家可以照脚本复制粘贴手工进行操作。可以节省输入命令的时间,减少了出错的几率。未来我将对脚本进行修改,以使其 真正做到一键安装。

 #!/bin/sh
###############################################
# ver 0.1.0
# 适用于 FreeBSD 7.2、8.0,推荐使用 FreeBSD 8.0
###############################################

################ 加装安全补丁 ##################
freebsd-update fetch
freebsd-update install

################ 复制必需的文件 ##################
tar zxvf femp-0.1.0.tar.gz #涉及到的所有安装文件,由于较大就不提供下载了,可自行制作
cd femp

################ 更新ports ##################
tar zxvf ports.tar.gz
cp -r ports/ /usr/ports/distfiles/

################ 安装pcre ##################
cd /usr/ports/devel/pcre
make install clean
rehash

################ 安装xml ##################
cd /usr/ports/textproc/libxml
make install clean

cd /usr/ports/textproc/libxml2
make install clean

################ 安装curl ##################
cd /usr/ports/ftp/curl
make install clean

################ 安装jpeg ##################
cd /usr/ports/graphics/jpeg
make install clean

################ 安装png ##################
cd /usr/ports/graphics/png
make install clean

################ 安装freetype ##################
cd /usr/ports/print/freetype
make install clean

cd /usr/ports/print/freetype2
make install clean

################ 安装autoconf ##################
cd /usr/ports/devel/autoconf262
make install clean

################ 安装nginx ##################
cd /home/imarmot/femp/
tar zxvf nginx-0.7.64.tar.gz
cd nginx-0.7.64
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
cd ..

cp nginx.conf /usr/local/nginx/conf/

################ 安装mysql ##################
tar zxvf mysql-5.1.41.tar.gz
cd mysql-5.1.41
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase --with-mysqld-user=mysql --without-ndb-debug --without-debug --with-charset=utf8 --localstatedir=/data/mysql/data --with-collation=utf8_general_ci
make
make install
cd ..

pw groupadd mysql
pw useradd mysql -g mysql -d /data/mysql -s /usr/sbin/nologin

mkdir -p /data/mysql/data/
chown -R mysql:mysql /data/mysql/
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data --user=mysql

cd /usr/local/mysql/share/mysql
cp my-large.cnf /etc/my.cnf
cp mysql.server /usr/local/mysql/mysqld
chmod 755 /usr/local/mysql/mysqld

/usr/local/mysql/mysqld start
/usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
# quit

cd /home/imarmot/femp/

################ 安装PHP ##################
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr
make
make install
cd ..

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure --prefix=/usr
make
make install
cd ..

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
./configure --prefix=/usr
make
make install
cd ..

tar zxvf php-5.2.11.tar.gz
gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11 -p1
cd php-5.2.11
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --disable-ipv6 --without-pear
make ZEND_EXTRA_LIBS='-liconv'
make install
cd ..
cp ./php.ini /usr/local/php/etc/
cp ./php-fpm.conf /usr/local/php/etc/

tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..

tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install
cd ..

tar zxvf ImageMagick-6.5.4-2.tar.gz
cd ImageMagick-6.5.4-2
./configure
make
make install
cd ..

tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cd ..

################ 创建需要的目录 ##################
mkdir -p /data/php/eaccelerator_cache

mkdir -p /data/www
chmod +w /data/www
chown -R www:www /data/www

################ 复制启动文件 ##################
cp rc.local /etc/

################ 安装mono ##################
cd /usr/ports/lang/mono
make install clean

################ 安装mono ##################
cd /home/imarmot/femp/
tar zxvf jexus-3.3.tar.gz
mkdir /usr/local/jexus/
cp -r jexus-3.3/ /usr/local/jexus/

posted @ 2010-09-03 21:13 与时俱进 阅读(...) 评论(...) 编辑 收藏
友情链接:同里老宅院民居客栈