一、脚本的环境介绍
二、脚本的介绍
三、脚本的功能介绍
一、脚本的环境介绍
此脚本运行在RHEL 6.4版本上
运行此脚本需注意:
1)、主机需要能够上网,因为博主是搭建的搜狐的外网yum源,此yum源由两部分组成,一个是光盘里面的所有软件包,一个是epel源。
2)、需了解软件之间的相互依赖性。
二、脚本的介绍
脚本是由函数组成,每一个函数实现一个功能
复制代码 代码如下:
function create_yum #此函数是搭建sohu的yum仓库
function download #此函数是下载全部所需的软件包
function install_apache #此函数是安装apache软件包
function config_apache #此函数是修改apache的服务脚本和开启
apache服务
function install_nginx #此函数是安装nginx软件包
function install_mysql #此函数是安装mysql软件包
function config_mysql #此函数是初始化mysql和开启mysql的服务
function install_php #此函数是安装php软件包
function config_php #此函数提供php的配置文件
function install_php_fpm #此函数是安装php-fpm软件包提供fastcgi服务
function config_php_fpm #此函数是修改php-fpm的配置文件盒开启
php-fpm的服务
function install_xcache #此函数是安装为php代码加速的软件包
function install_memcache #此函数是安装连接memcached的软件包
function install_memcached #此函数是安装memcached软件包
function install_lamp #此函数里面只包含了apache,mysql,php的函数
function config_lamp
function install_lammp #此函数里面只包含了apache,mysql,
memcached,php的函数
function config_lammp
function install_lnmp #此函数里面只包含了nginx,mysql,php的函数
function config_lnmp
function install_lnmmp #此函数里面只包含了nginx,mysql,
memcached,php的函数
function config_lnmmp
如果各位博友觉得配置文件的路径存放数据的路径与各位博友所要求的结果不一样,那请各位博友只需小小的自行修改一下
三、脚本的功能介绍
1)、支持某台机器单独安装某一个软件,如apache、nginx、mysql、php-fpm,memcached
2)、支持某台机器直接安装lamp、lnmp、lammp、lnmmp架构
3)、如果想一个一个的安装lamp(lnmp)架构,请注意安装顺序:apache(nginx)-->
mysql-->php
4)、php与php-fpm其实都是安装php源码软件包,但是提供的功能不一样
如果你的apache与php安装在不同的机器上,那么php的那台主机安装的是
php-fpm;
如果你的php与mysql安装在不同的机器上,那么php的那台主机也是安装
php-fpm;
php-fpm与memcached安装在不同的机器上,那么php-fpm的那台主机必须安装memcache,用于连接memcached。
5)、安装完每个脚本后,会把源码包生成的文件与系统能识别的头文件、库文件、二进制中
6)、会为服务提供system V 脚本文件
7)、会自行的把服务开启,并加入到开机自动启动的服务列表中
整个脚本
复制代码 代码如下:
#!/bin/bash
#discripte:frist,you linux server must be surf Internet because we use http://mirrors.sohu.com/ yum source and epel source
function create_yum {
dir=/etc/yum.repos.d/
mv $dir/*.repo /tmp
cat $dir/sohu.repo <<EOF
[centos]
name=sohu-centos
baseurl=http://mirrors.sohu.com/centos/\$releasever/os/\$basearch
gpgcheck=1
enable=0
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-6
[epel]
name=sohu-epel
baseurl=http://mirrors.sohu.com/fedora-epel/\$releasever/\$basearch/
enable=1
gpgcheck=0
EOF
yum clean all &>/dev/null
}
function download {
yum -y install wget
cd /root
echo -e "\033[32m=========download about web server source package==========\033[0m"
wget http://mirror.esocc.com/apache/apr/apr-1.4.6.tar.bz2
wget http://mirror.esocc.com/apache/apr/apr-util-1.5.2.tar.bz2
wget http://mirror.esocc.com/apache/httpd/httpd-2.4.6.tar.bz2
wget http://nginx.org/download/nginx-1.4.2.tar.gz
echo -e "\033[32m=========download about php or php-fpm soure package========\033[0m"
wget http://xcache.lighttpd.net/pub/Releases/3.0.3/xcache-3.0.3.tar.bz2
wget http://pecl.php.net/get/memcache-2.2.7.tgz
wget http://downloads.php.net/stas/php-5.4.19.tar.bz2
echo -e "\033[32m======download about memcached source package========\033[0m"
wget http://nchc.dl.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.21-stable.tar.gz
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
echo -e "\033[32m======download about mysql source package=========\033[0m"
wget http://mysql.llarian.net/Downloads/MySQL-5.5/mysql-5.5.33.tar.gz
}
function install_apache {
cd /root
yum -y install pcre-devel
tar xf apr-1.4.6.tar.bz2
tar xf apr-util-1.5.2.tar.bz2
tar xf httpd-2.4.6.tar.bz2
cd /root/apr-1.4.6
./configure --prefix=/usr/local/apr && make && make install
echo -e "\033[32m=========apr is ok========\033[0m"
cd /root/apr-util-1.5.2
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
echo -e "\033[32m=========apr-util is ok========\033[0m"
cd /root/httpd-2.4.6
./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib \
--with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most \
--enable-mpms-shared=all --with-mpm=event && make && make install
echo -e "\033[32m=========httpd is ok========\033[0m"
}
function config_apache {
echo -e "\033[32m frist,Associated system path \033[0m"
echo "PATH=/usr/local/apache/bin/:$PATH" >/etc/profile.d/httpd.sh
source /etc/profile.d/httpd.sh
ln -sv /usr/local/apache/include/ /usr/include/httpd
echo -e "\033[32m second,Modify configuration files and provided systemV scripts \033[0m"
IP=`ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk -F: '{print $2}' | cut -d' ' -f1`
cp /root/httpd-2.4.6/build/rpm/httpd.init /etc/rc.d/init.d/httpd
sed -i '/httpd/s/usr\/sbin\/httpd/usr\/local\/apache\/bin\/httpd/g' /etc/rc.d/init.d/httpd
sed -i '/^httpd/a\prog=httpd' /etc/rc.d/init.d/httpd
sed -i '/^pidfile/s/var\/run/usr\/local\/apache\/logs/g' /etc/rc.d/init.d/httpd
sed -i 's/etc\/httpd\/conf\/httpd.conf/usr\/local\/apache\/conf\/httpd.conf/g' /etc/rc.d/init.d/httpd
sed -i '$a ServerName '$IP':80' /usr/local/apache/conf/httpd.conf
chkconfig --add httpd
chkconfig --level 35 httpd on
service httpd start
}
function install_nginx {
cd /root
yum -y install pcre-devel
tar xf nginx-1.4.2.tar.gz
groupadd nginx
useradd -r -g nginx nginx
cd /root/nginx-1.4.2
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre && make && make install
echo -e "\033[32m=========nginx is ok========\033[0m"
}
function install_mysql {
cd /root
yum -y install cmake bison
useradd -r mysql
tar xf mysql-5.5.33.tar.gz
cd /root/mysql-5.5.33
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/data -DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
echo -e "\033[32m=========mysqld is ok========\033[0m"
}
function config_mysql {
echo -e "\033[32m frist,Associated system path,and Initialization database \033[0m"
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chown -R root.mysql /usr/local/mysql/
mkdir -pv /mydata/data
chown -R mysql:mysql /mydata/data/
sed -i '/thread_concurrency/a\ datadir = /mydata/data' /etc/my.cnf
sed -i '/datadir/a\ innodb_file_per_table = 1' /etc/my.cnf
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mydata/data/ --basedir=/usr/local/mysql
service mysqld start
echo "PATH=/usr/local/mysql/bin:$PATH" >/etc/profile.d/mysqld.sh
source /etc/profile.d/mysqld.sh
echo "/usr/local/mysql/lib" >/etc/ld.so.conf.d/mysqld.conf
ldconfig -v | grep mysql
ln -sv /usr/local/mysql/include/ /usr/include/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on
}
function install_php {
yum -y install libxml2-devel bzip2-devel curl-devel libmcrypt-devel mhash-devel
tar xf php-5.4.19.tar.bz2
cd /root/php-5.4.19
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr \
--enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-curl \
--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
make && make install
echo -e "\033[32m=========php is ok========\033[0m"
}
function config_php {
cp /root/php-5.4.19/php.ini-production /etc/php.ini
}
function install_php_fpm {
yum -y install libxml2-devel bzip2-devel curl-devel libmcrypt-devel mhash-devel
tar xf php-5.4.19.tar.bz2
cd /root/php-5.4.19
./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd \
--with-openssl --enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir \
--with-zlib-dir --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt --with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl --enable-maintainer-zts --enable-fpm && make && make install
echo -e "\033[32m=========php-fpm is ok========\033[0m"
}
function config_php_fpm {
echo -e "\033[32m frist,Associated system path \033[0m"
IP2=`ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk -F: '{print $2}' | cut -d' ' -f1`
cp /root/php-5.4.19/php.ini-production /etc/php.ini
echo "PATH=/usr/local/php/bin:/usr/local/php/sbin:$PATH" >/etc/profile.d/php-fpm.sh
source /etc/profile.d/php-fpm.sh
echo -e "\033[32m second,Modify configuration files and provided systemV scripts \033[0m"
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
sed -i 's/127\.0\.0\.1/'$IP2'/g' /usr/local/php/etc/php-fpm.conf
cp /root/php-5.4.19/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
service php-fpm start
chkconfig --add php-fpm
chkconfig --level 35 php-fpm on
}
function install_xcache {
cd /root
tar xf xcache-3.0.3.tar.bz2
if [ -d /usr/local/php ];then
cd /root/xcache-3.0.3
/usr/local/php/bin/phpize
./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
make && make install
else
install_php_fpm
cd /root/xcache-3.0.3
/usr/local/php/bin/phpize
./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
make && make install
echo -e "\033[32m=========xcache is ok========\033[0m"
fi
}
function install_memcache {
cd /root
tar xf memcache-2.2.7.tgz
if [ -d /usr/local/php ];then
cd /root/memcache-2.2.7
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache && make && make install
else
install_php_fpm
cd /root/memcache-2.2.7
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache && make && make install
echo -e "\033[32m=========memcache is ok========\033[0m"
fi
}
function install_memcached {
cd /root
tar xf libevent-2.0.21-stable.tar.gz
tar xf memcached-1.4.15.tar.gz
cd /root/libevent-2.0.21-stable
./configure --prefix=/usr/local/libevent && make && make install
echo -e "\033[32m=========libevent is ok========\033[0m"
cd /usr/local/libevent/
echo "/usr/local/libevent/lib" >/etc/ld.so.conf.d/libevent.conf
ldconfig -v | grep libevent
ln -sv /usr/local/libevent/ /usr/include/libevent
cd /root/memcached-1.4.15
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/
make && make install
echo -e "\033[32m=========memcached is ok========\033[0m"
}
function install_lamp {
install_apache
install_mysql
install_php
install_xcache
}
function config_lamp {
config_apache
config_mysql
config_php
}
function install_lnmp {
install_nginx
install_mysql
install_php
install_xcache
}
function config_lnmp {
config_mysql
config_php
}
function install_lammp {
install_apache
install_mysql
install_php
install_xcache
install_memcache
install_memcached
}
function config_lammp {
config_apache
config_mysql
config_php
config_php_fpm
}
function install_lnmmp {
install_nginx
install_mysql
install_php
install_xcache
install_memcache
install_memcached
}
function config_lnmmp {
config_mysql
config_php
config_php_fpm
}
echo -e "\033[32m====make sure yum is ok=========\033[0m"
#create_yum
echo -e "\033[32m====now,download all package====\033[0m"
#download
echo -e "\033[32m====install development packages====\033[0m"
#yum -y groupinstall "Development tools" "Server Platform Development"
echo -e "\033[32m=========you can choice you need install package==========\033[0m"
cat <<EOF
apache|A) install apache source package.
nginx|N) install nginx source package.
mysql|M) install mysql source package.
php|P) install php source package.
php-fpm|PF) install php-fpm source package.
xcache|X) install xcahe source package.
memcache|ME) install memcache source package.
memcached|MD) install memcached source package.
lamp) install lamp source package.
lammp) install lammp source package.
lnmp) install lnmp source package.
lnmmp) install lnmmp source package.
q|Q) quit
EOF
read -p "Please choose to install: " Choice
echo -e "\033[32m=====start install $Choice====\033[0m"
until [ $Choice == q -o $Choice == Q ];do
case $Choice in
apache|A)
install_apache
config_apache ;;
nginx|N)
install_nginx ;;
mysql|M)
install_mysql
config_mysql ;;
php|P)
install_php
config_php ;;
php-fpm|PF)
install_php_fpm
config_php_fpm ;;
xcache|X)
install_xcache ;;
memcache|ME)
install_memcache ;;
memcached|MD)
install_memcached ;;
lamp)
install_lamp
config_lamp ;;
lammp)
install_lammp
config_lammp ;;
lnmp)
install_lnmp
config_lnmp ;;
lnmmp)
install_lnmmp
config_lnmmp ;;
q|Q)
break
esac
read -p "Have any choice agin, if you no,q|Q is quit: " Choice
done
这个脚本和nginx systemV,memcached system V的脚本以附件的形式上传了,点此下载
缺陷:
1)、没能为nginx提供自动化system V脚本,但是nginx的system V脚本我会以附件的方式上传,各位博友需要 vim /etc/rc.d/init.d/nginx 然后copy我提供的system V脚本然后添加权限,就可以service nginx start了
2)、也没能为memcached提供自动化system V脚本,但是memcached的system V脚本会以附件方式上传,各位博友需要 vim /etc/rc.d/init.d/memcached 然后copy我提供的system V脚本然后添加权限,就可以service memcached start了
本文出自 “技术之路---桀” 博客
LAMP,LNMP
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新动态
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]