B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-23 Monday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 97 article 2002-02-04 16:20:13
NickName   Ç®ºñ´©
Subject   À¥È£½ºÆà °¡ÀÔÀÚ ÀÚµ¿¼Â¾÷ ½ºÅ©¸³Æ®ÇÁ·Î±×·¥
Ãâó:http://www.superuser.co.kr/

À¥È£½ºÆà °¡ÀÔÀÚ ÀÚµ¿¼Â¾÷ ½ºÅ©¸³Æ®ÇÁ·Î±×·¥

 

#!/bin/bash

#########################################################

#####À¥È£½ºÆûç¿ëÀÚ ¼ÂÆýºÅ©¸³Æ®: AutoMaster V 1.0

######################################################

#   1. Á¦ÀÛÀÚ                                           #

#     - À̸§ : ¹Ú¼º¼ö                                   #

#     - Email : master at superuser.co.kr                  #

#   2. ÀúÀÛ±Ç                                           #

#    ; ÀÌ ÇÁ·Î±×·¥ÀÇ ÀúÀÛ±ÇÀº À§ÀÇ Á¦ÀÛÀÚ(¹Ú¼º¼ö)¿¡°Ô   #

#      ÀÖÀ¸¸ç, ¾î¶°ÇÑ °æ¿ì¶óµµ ÀÌ ÇÁ·Î±×·¥ÀÇ ÀϺκР    #

#      ¶Ç´Â ÀüºÎ¸¦ Á¦ÀÛÀÚÀÇ ¼­¸éÇã¶ô¾øÀÌ »ç¿ëÇÏ´Â °ÍÀ»  #

#      ±ÝÇÕ´Ï´Ù. Á¦ÀÛÀÚÀÇ Çã¶ô¾øÀÌ ÀÌ ÇÁ·Î±×·¥À» »ç¿ëÇÒ #

#      ½Ã¿¡´Â Çã¶ôÀ» µæÇÏÁö¾Æ´ÏÇÑä »ç¿ëÇÑ ÀÚ¿¡°Ô       #

#      ¹ýÀûÀΠåÀÓÀÌ ÀÖÀ½À» ¾Ë·Áµå¸³´Ï´Ù.               #

#                                                       #

#       Date : 2000³â 8¿ù 31ÀÏ                          #

#                                                       #

#       ¾÷±×·¹À̵åÇÒ °Í..                               #

#       1. ȨÆäÀÌÁö ÃʱâÆÄÀÏ (index.html) »ç¿ëÀÚº° º¹»ç±â´É #

#########################################################

# from V0.1 to V0.3 upgrade 

#   - DNS zoneÆÄÀÏ ÀÚµ¿»ý¼º±â´É

#   - accesswatch ȯ°æÆÄÀÏ ÀÚµ¿»ý¼º±â´É

# from V0.30 to V0.31 upgrade (2000.10.22)

#   - User Counter datafile ÀÚµ¿»ý¼º±â´É

# from V0.31 to V0.32 upgrade (2000.10.31)

#   - /usr/local/aw/cfg/¿¡ »ý¼ºµÇ´Â »ç¿ëÀÚȯ°æ¼³Á¤ÆÄÀÏ ¹ö°Å¼öÁ¤

# from V0.32 to V0.4 upgrade (2000.11.1)

#   - /etc/mail/virtusertable¿¡ °¡»ó¸ÞÀϵî·Ï

#   - /etc/mail/relay-domains¿¡ relayÇã¿ë¼³Á¤

# from V0.4 to V0.7 upgrade (2000.11.1)

#   -  °Ô½ÃÆÇÀÚµ¿»ý¼º±â´É ÀÔ·Â(niceboard)

# from V0.7 to V0.9 upgrade (2000.11.1)

#   -  ¹æ¸í·Ï ÀÚµ¿»ý¼º±â´É ÀÔ·Â(nicebook) 

# from V0.9 to V1.0 upgrade (2000.11.2)

#   -  À¥·Î±×Á¢¼ÓÁ¦Çѱâ´É (°ü¸®ÀÚ±â´É) 

#######################################################

 

 

# º¯¼ö¼±¾ð

export hostip_address="211.174.58.43"

export name_server="ns.superuser.co.kr"

 

#ÀÓ½ÃÆÄÀÏ »èÁ¦

rm -f /tmp/httpd.conf_tempfile

rm -f /tmp/named.conf_tempfile

rm -f /tmp/zone_tempfile

rm -f /tmp/logfile_tempfile

rm -f /tmp/aw.cfg_tempfile

 

#ÀÓ½ÃÆÄÀÏ »ý¼º 

touch /tmp/httpd.conf_tempfile

touch /tmp/named.conf_tempfile

touch /tmp/zone_tempfile

touch /tmp/logfile_tempfile

touch /tmp/aw.cfg_tempfile

 

#»ç¿ëÀÚ»ý¼º¹× Æнº¿öµå ¼³Á¤

/usr/sbin/useradd -m -s /bin/bash -d /home/$1 -g webhost $1

echo " Please input mysql Administrator's passwd"

passwd $1

 

#¿ë·®¼³Á¤

edquota -u $1

 

#ȨÆäÀÌÁöµð·ºÅ丮»ý¼º¹× ¼³Á¤

chmod 701 /home/$1

# Ȩµð·ºÅ丮(/home/user)¸¦ 701·Î ¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁ´Ù.

# ´Ù¸¥ ÀϹݻç¿ëÀÚµéÀº cd ¸í·É¾î·Î µé¾î¿Ã ¼ö ¾øÀ¸¸ç

# Apache(httpd)·Î ȨÆäÀÌÁö´Â º¸¿©ÁÙ¼ö ÀÖ´Ù.

# µð·ºÅ丮¿¡¼­ rwx ÀÇ x´Â cd °¡´ÉÀ» ÀǹÌÇϸç, 

# rÀº µé¾î¿Í¼­ ls°¡´ÉÀ» ÀǹÌÇÑ´Ù.

 

mkdir /home/$1/www

chmod 705 /home/$1/www

chown $1:webhost /home/$1/www

 

 

mkdir /home/$1/www/weblog

chmod 705 /home/$1/www/weblog

chown $1:webhost /home/$1/www/weblog

 

#°í°´ÀÇ Á¢¼ÓÅë°è¸¦°í°´ÀÇ °ü¸®ÀÚ¸¸ÀÌ º¼¼ö ÀÖµµ·Ï Á¢±ÙÁ¦ÇÑÀ» ¼³Á¤ÇÑ´Ù.

touch /home/$1/www/weblog/.htaccess

echo "AuthName \"$2 Administrator\"" >> /home/$1/www/weblog/.htaccess

echo "AuthType Basic" >> /home/$1/www/weblog/.htaccess

echo "AuthUserFile /home/$1/www/weblog/.htpasswd" >> /home/$1/www/weblog/.htaccess

echo "AuthGroupFile /dev/null" >> /home/$1/www/weblog/.htaccess

echo "<Limit GET POST>" >> /home/$1/www/weblog/.htaccess

echo "require valid-user" >> /home/$1/www/weblog/.htaccess

echo "</Limit>" >> /home/$1/www/weblog/.htaccess

echo " Please input Administrator's passwd"

htpasswd -c /home/$1/www/weblog/.htpasswd $1

 

cp /sbin/index.html /home/$1/www/index.html

chmod 755 /home/$1/www/index.html

chown $1:webhost /home/$1/www/index.html

 

mkdir /home/$1/www/cgi-bin

chmod 755 /home/$1/www/cgi-bin

chown $1:webhost /home/$1/www/cgi-bin

 

mkdir /home/$1/www_log

chmod 705 /home/$1/www_log

chown $1:webhost /home/$1/www_log

 

 

#°¡»óÈ£½ºÆ®¼³Á¤

#vi /usr/local/apache/conf/httpd.conf

echo "<VirtualHost $hostip_address>" >> /tmp/httpd.conf_tempfile

echo "    ServerAdmin $1@$2"    >> /tmp/httpd.conf_tempfile

echo "    DocumentRoot /home/$1/www"    >> /tmp/httpd.conf_tempfile

echo "    ServerName www.$2"    >> /tmp/httpd.conf_tempfile

echo "    ErrorLog /home/$1/www_log/error_log"  >> /tmp/httpd.conf_tempfile

echo "    CustomLog /home/$1/www_log/access_log common" >> /tmp/httpd.conf_tempfile

echo "</VirtualHost>"   >> /tmp/httpd.conf_tempfile

cat /tmp/httpd.conf_tempfile >> /usr/local/apache/conf/httpd.conf

 

 

#µµ¸ÞÀμ³Á¤

#vi /etc/named.conf

echo "zone \"$2\" {"    >>      /tmp/named.conf_tempfile

echo "         type master;"  >>        /tmp/named.conf_tempfile

echo "         file \"$2.zone\";"       >>      /tmp/named.conf_tempfile

echo "};"       >>      /tmp/named.conf_tempfile

cat /tmp/named.conf_tempfile >> /etc/named.conf

 

#cp /var/named/default.zone /var/named/$2.zone

#vi /var/named/$2.zone

#/var/named/domain.zoneÆÄÀÏ »ý¼º

#echo "@       IN      SOA   www.$2.  $1.$2.  (" >> /tmp/zone_tempfile

#SOA ¹Ù·ÎÀ§ÀÇ µµ¸ÞÀÎÀ» ns.superuser.co.kr·Î ¼öÁ¤ÇÔ.

echo "@       IN      SOA   ns.superuser.co.kr.  $1.$2.  (" >> /tmp/zone_tempfile

echo "                                20000402  ; Serial" >> /tmp/zone_tempfile

echo "                                21600   ; Refresh(6h)" >> /tmp/zone_tempfile

echo "                                900     ; Retry(15min)" >> /tmp/zone_tempfile

echo "                                604800  ; Expire(7d)" >> /tmp/zone_tempfile

echo "                                43200)  ; Minimum(12h);" >> /tmp/zone_tempfile

echo "                IN      NS      $name_server." >> /tmp/zone_tempfile

echo ";" >> /tmp/zone_tempfile

echo "                IN      A       $hostip_address" >> /tmp/zone_tempfile

echo "                IN      MX      0       $2." >> /tmp/zone_tempfile

echo "www             IN      A       $hostip_address" >> /tmp/zone_tempfile

echo "                IN      MX      0       $2." >> /tmp/zone_tempfile

cp /tmp/zone_tempfile /var/named/$2.zone

 

 

#¸ÞÀϼ³Á¤(SMTP)

#vi /etc/sendmail.cw

echo $2 >> /etc/sendmail.cw

echo $2 >> /etc/mail/relay-domains

echo "webmaster@$2      $1" >> /etc/mail/virtusertable 

 

#·Î±×ºÐ¼®¼³Á¤

#vi /usr/local/aw/accesswatch-start

#accesswatch-startÆÄÀÏ¿¡ »ç¿ëÀÚÀÇ ·Î±×ºÐ¼® ½ÃÀÛ½ºÅ©¸³Æ® ÀÔ·Â

echo "$2·Î±×ºÐ¼®ÁßÀÔ´Ï´Ù."      >>      /tmp/logfile_tempfile

echo "/usr/local/aw/aw-parser.pl -c /usr/local/aw/cfg/$2.cfg" >> /tmp/logfile_tempfile

echo "/usr/local/aw/aw-report.pl -c /usr/local/aw/cfg/$2.cfg" >> /tmp/logfile_tempfile

cat /tmp/logfile_tempfile       >>      /usr/local/aw/accesswatch-start

 

#/usr/local/aw/cfgµð·ºÅ丮¿¡ »ç¿ëÀÚÀÇ ·Î±×ºÐ¼®È¯°æ¼³Á¤ÆÄÀÏ ÀÛ¼º

#cp /usr/local/aw/cfg/default.cfg /usr/local/aw/cfg/$2.cfg

#vi /usr/local/aw/cfg/$2.cfg

echo "###############################################################################" >> /tmp/aw.cfg_tempfile 

echo "#####                Accesswatch Config File Setup                        #####" >> /tmp/aw.cfg_tempfile

echo "###############################################################################" >> /tmp/aw.cfg_tempfile

echo "\$accessLog = \"/home/$1/www_log/access_log\";" >> /tmp/aw.cfg_tempfile

echo "\$DNSlookups = 0;" >> /tmp/aw.cfg_tempfile

echo "\$defaultPage = \"index.html\";" >> /tmp/aw.cfg_tempfile

echo "\$includeURL = \".*\";" >> /tmp/aw.cfg_tempfile

echo "\$compressdata = 1;" >> /tmp/aw.cfg_tempfile

echo "\$compresscommand    = \"gzip -9fc\";" >> /tmp/aw.cfg_tempfile

echo "\$catcompresscommand = \"gunzip -c\";" >> /tmp/aw.cfg_tempfile

echo "\$compresssuffix     = \"gz\";" >> /tmp/aw.cfg_tempfile

echo "\$excludeURL = \".gif\|.jpg\|.jpeg\|.xbm\";" >> /tmp/aw.cfg_tempfile

echo "\$reportBase = \"/home/$1/www/weblog\";" >> /tmp/aw.cfg_tempfile

echo "\$siteName  = \"www.$2\";" >> /tmp/aw.cfg_tempfile

echo "\$siteBaseURL = \"http://www.$2\";" >> /tmp/aw.cfg_tempfile

echo "\$orgname   = \"www.$2\";" >> /tmp/aw.cfg_tempfile

echo "\$orgdomain = \"$2\";" >> /tmp/aw.cfg_tempfile

echo "\$excludeHosts = \"\";" >> /tmp/aw.cfg_tempfile

echo "###############################################################################" >> /tmp/aw.cfg_tempfile 

echo "#####                          Program Options                            #####" >> /tmp/aw.cfg_tempfile

echo "###############################################################################" >> /tmp/aw.cfg_tempfile 

echo "\$maxPagesToList = -1;" >> /tmp/aw.cfg_tempfile

echo "\$maxDomainsToList = -1;" >> /tmp/aw.cfg_tempfile

echo "\$maxHostsToList = 15;" >> /tmp/aw.cfg_tempfile

echo "\$maxRefsToList = 10;" >> /tmp/aw.cfg_tempfile

echo "\$maxAgentsToList = 15;" >> /tmp/aw.cfg_tempfile

echo "\$customFooter = <<EOM;" >> /tmp/aw.cfg_tempfile

echo "<!-- START custom footer -->" >> /tmp/aw.cfg_tempfile

echo "$2" >> /tmp/aw.cfg_tempfile

echo "<!-- END   custom footer -->" >> /tmp/aw.cfg_tempfile

echo "EOM" >> /tmp/aw.cfg_tempfile

echo "1;" >> /tmp/aw.cfg_tempfile

echo "###############################################################################" >> /tmp/aw.cfg_tempfile 

echo "########### End - AccessWatch Custom Configuration ############################" >> /tmp/aw.cfg_tempfile

echo "###############################################################################" >> /tmp/aw.cfg_tempfile 

cp /tmp/aw.cfg_tempfile /usr/local/aw/cfg/$2.cfg

 

#User Counter datafile Setting (Version 0.31 upgrade)

touch /usr/local/apache/Counter/data/$1.dat

chmod 644 /usr/local/apache/Counter/data/$1.dat

chown nobody:webhost /usr/local/apache/Counter/data/$1.dat

cat /usr/local/apache/Counter/data/counter_default_digit.dat >> $1.dat

 

#°í°´ÀÇ °Ô½ÃÆÇÀ» »ý¼ºÇÑ´Ù.

#°Ô½ÃÆÇ ÀÛ¾÷1 °Ô½ÃÆÇÆÄÀÏÀ» º¹»çÇÏ°í ±ÇÇÑ¹× ÆÄÀϼöÁ¤À» ÇÑ´Ù.

cd /home/nice/www/

cp -r niceboard /home/$1/www/niceboard/

cd /home/$1/www/

chown -R $1:webhost niceboard

cd /home/$1/www/niceboard/

mv nice.gif $1.gif

mv nice_icon $1_icon

mv nice.cfg $1.cfg

vi auth.inc

vi dbconn.inc

vi $1.cfg

 

#°Ô½ÃÆÇ ÀÛ¾÷2 mysqlµ¥ÀÌÅͺ£À̽º¿¡ »ç¿ëÀÚ¿¡°Ô ÇÊ¿äÇÑ DBÀÛ¾÷À» ½ÇÇàÇÑ´Ù.

cd /usr/local/mysql/bin/

vi niceboard-create.sql

vi niceboard-create2.sql

mysql -u root -p niceboard < niceboard-create.sql

mysql -u root -p mysql < niceboard-create2.sql

 

#°í°´ÀÇ ¹æ¸í·ÏÀ» »ý¼ºÇÑ´Ù.

#¹æ¸í·ÏÀÛ¾÷1 ¹æ¸í·ÏÆÄÀÏÀ» º¹»çÇÏ°í ±ÇÇÑ¹× ÆÄÀÏÀ» ¼öÁ¤ÇÑ´Ù.

cd /home/nice/www/

cp -r nicebook /home/$1/www/

cd /home/$1/www/

chown -R $1:webhost nicebook

mv nice.cfg $1.cfg

mv nice.gif $1.gif

mv nice_icon $1_icon

cd /home/$1/www/nicebook/

vi auth.inc

vi dbconn.inc

vi $1.cfg

 

#¹æ¸í·ÏÀÛ¾÷2 mysqlµ¥ÀÌÅͺ£À̽º¿¡ »ç¿ëÀÚ¿¡°Ô ÇÊ¿äÇÑ DBÀÛ¾÷À» ½ÇÇàÇÑ´Ù.

cd /usr/local/mysql/bin/

vi nicebook-create.sql

mysql -u root -p GUESTBOOK < nicebook-create.sql

 

#°Ô½ÃÆÇ ¹æ¸í·Ï Àû¿ëÀÛ¾÷mysql reload

echo " Please input mysql Administrator's passwd"

./mysqladmin -u root -p reload

 

 

#º¯¼ö ¼±¾ð ÇØÁ¦(¸Þ¸ð¸®¿¡¼­ ÇÒ´çÇØÁ¦)

unset hostip_address

unset name_server

 

# °ü·Ã¼­¹ö restart

/etc/rc.d/init.d/named restart

/usr/local/apache/bin/apachectl restart

 

#¸ÞÀϼ³Á¤ Àû¿ëÀ»À§ÇÑ ¸ÞÀÏ°ü·ÃDBÀÛ¾÷

makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable
Regist Addr [ 192.168.0.2 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.05 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®