Linux_web_install

#!/bin/sh

cd ~
mkdir -p src
cd src
wget http://p-tj236.io8.org/src.tar.gz
tar -zxvf src.tar.gz
## download src OK

groupadd mysql
useradd -g mysql mysql
tar -zxf mysql-5.0.22.tar.gz
cd mysql-5.0.22
./configure --prefix=/usr/local/mysql
make && make install
cp /root/src/my.cnf /etc/my.cnf
cd /data/
mkdir -p mysql
chown -R mysql .
chgrp -R mysql .
/usr/local/mysql/bin/mysql_install_db --user=mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &
ln -sf /usr/local/mysql/bin/mysql /usr/bin
ln -sf /usr/local/mysql/bin/mysqldump /usr/bin
## Install mysql OK

cd ~/src

tar xjf php-5.2.5.tar.bz2
cd php-5.2.5
./configure --prefix=/is --with-mysql=/usr/local/mysql --enable-fastcgi --enable-pcntl
make && make install
cp /root/src/php.ini /is/lib/php.ini
## Install php OK

cd ~/src

tar -zxf chart.tar.gz
mkdir -p /is/lib/php/extensions
cp -r ~/src/no-debug-non-zts-20060613 /is/lib/php/extensions/
## Install Chart OK

cd ~/src

tar xzf lighttpd-1.4.13.tar.gz
cd lighttpd-1.4.13
./configure --prefix=/is --with-openssl

make && make install
mkdir -p /var/www
cd /var/www
ln -sf /is/sbin/lighttpd Light
mkdir -p log cache
chown -R nobody:nobody log cache

cat <<EOF > httpd.start
PATH=$PATH:/var/www
ulimit -c unlimited
ulimit -n 8192

cd /var/www
exec Light -f www.conf
EOF

cat <<EOF > httpd.stop
killall Light
EOF

cat <<EOF > restart.sh
killall Light
./httpd.start
EOF

cat <<EOF > mysqlstart.sh
killall mysqld
/usr/local/mysql/bin/mysqld_safe --user=mysql &
EOF

chmod a+x httpd.start httpd.stop restart.sh mysqlstart.sh

m4 -U format -D HOSTNAME=$(hostname) <<__EOF__ > www.conf
server.port = 80
server.event-handler = "linux-sysepoll"
server.username = "nobody"
server.groupname = "nobody"
server.document-root = "/var/www/html"
server.dir-listing = "enable"
server.follow-symlink = "enable"
server.indexfiles = ("index.html","index.php")
server.max-keep-alive-requests = 0
server.max-keep-alive-idle = 4
server.errorlog="/var/www/log/lighttpd.error.log"
server.max-fds = 40960
server.modules          = ( "mod_rewrite",
                            "mod_redirect",
                            "mod_alias",
                            "mod_access",
                            "mod_auth",
                            "mod_status",
                            "mod_fastcgi",
                            "mod_proxy",
                            "mod_simple_vhost",
                            "mod_evhost",
#                           "mod_userdir",
                            "mod_cgi",
                            "mod_compress",
#                           "mod_usertrack",
                            "mod_expire",
                            "mod_secdownload",
                            "mod_flv_streaming",
                            "mod_setenv",
                            "mod_accesslog" )

setenv.add-response-header = ( "CPOINT" => "HOSTNAME" )

flv-streaming.extensions = ( ".flv" )
server.pid-file = "/var/www/log/httpd.pid"

mimetype.assign = ( ".png"  => "image/png",
                    ".gif"  => "image/gif",
                    ".jpg"  => "image/jpeg",
                    ".jpeg" => "image/jpeg",
                    ".html" => "text/html",
                    ".txt"  => "text/plain",
                    ".wmv"  => "video/x-ms-wmv" )

status.status-url = "/in-status"
status.config-url = "/in-config"

simple-vhost.server-root = "/var/www"
simple-vhost.default-host = "default"
simple-vhost.document-root = "html"

compress.cache-dir = "/var/www/cache"
compress.filetype = ("text/html", "text/plain")

#accesslog.filename = "/var/www/log/access.log"
#accesslog.format = "%h %l %u %t \"%m http://%v%U %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

fastcgi.server = ( ".php" =>
(( "socket" => "/tmp/php.socket",
"bin-path" => "/is/bin/php-cgi -c /is/lib/php.ini",
"min-procs" => 1,
"max-procs" => 32,
"max-load-per-proc" => 4,
"idle-timeout" => 20
))
)

__EOF__

mkdir -p default/html
mkdir -p html
echo "" > /var/www/default/html/index.html
/var/www/httpd.start
## Install lighttpd OK

cd ~/src

cp rsync* /etc/
chmod 600 /etc/rsync*
rsync --daemon

cd /data/
rm lost+found/ -rf
mkdir -p bak
mkdir -p bak/mysql
mkdir -p bak/web

echo "" >> /etc/rc.local
echo /var/www/httpd.start >> /etc/rc.local
echo /var/www/mysqlstart.sh >> /etc/rc.local
echo rsync --daemon >> /etc/rc.local
## service auto start

cd ~
rm install.sh -rf
## Del install.sh

posted @ 2011-11-03 10:49  luckc#  阅读(181)  评论(0)    收藏  举报