Task 1 – UserAdmin (webmaster – UID1100)
Task 2 – Webserver (virtual hosts)
Task 3 – Monitor WebServer (xinetd)
Task 4 – Monitor Server1 (script)
-------------------------------------------------------------------a) server1
useradd webmaster -u 1100 -g 100 -m
b) server2
useradd -c "Thomas Barnes" tbarnes -u 1010 -g 100 -m
useradd -c "James King" jking -u 1011 -g 100 -m
passwd tbarnes (novell)
passwd jking (novell)
c) su - tbarnes
ssh-keygen -t dsa (default location, no passphrase)
exit
su - jking
ssh-keygen -t dsa (default location, no passphrase)
exit
d) cat /home/tbarnes/.ssh/id_dsa.pub > authorized_keys
cat /home/jking/.ssh/id_dsa.pub >> authorized_keys
server1
md /home/webmaster/.ssh
server2
scp authorized_keys 192.168.146.10:/home/webmaster/.ssh/
------------------------------------------------------------
Apache2 in /etc/apache2/*.conf and file at /etc/sysconfig/apache2
a) server1/server2
vi /etc/hosts
192.168.146.10 virtual1.digitalairlines.com
192.168.146.10 virtual2.digitalairlines.com
server1
cd /etc/apache2
vi listen.conf
NameVirtualHost *:80
b-c) cd vhosts.d
cp vhost.template virtual1.conf
vi virtual1.conf
ServerAdmin webmaster@digitalairlines.com
ServerName virtual1.digitalairlines.com
DocumentRoot /srv/www/htdocs/virtual1/
ErrorLog /var/log/apache2/virtual1/error_log
CustomLog /var/log/apache2/virtual1/access_log combined
Options FollowSymLinks
*remove the rest
cp virtual1.conf virtual2.conf
vi virtual2.conf
:%s/virtual1/virtual2/g
apache2ctl configtest (chk for syntax err, httpd error can be ignored)
d) cd /var/log/apache2 md virtual1 virtual2
cd /srv/www/htdocs md virtual1 virtual2
cp /srv/www/htdocs/index.html virtual1 cp /index.html virtual2
e) rcapache2 start insserv apache2
w3m http://virtual1.digitalairlines.com
w3m http://virtual2.digitalairlines.com
----------------------------------------------------
a-b) vi /etc/xinetd.d/systat
server_args = uU wwwrun
log_type = syslog daemon
only_from = server2
c) rcxinetd start
insserv xinetd
d) vi /etc/syslog-ng/syslog-ng.conf
filter f_xinetd { match("xinetd"); };
destination xinetd { file("/var/log/xinetd.log"); };
log { source(src); filter(f_xinetd); destination(xinetd); };
f_messages { not facility(news, mail) and not filter(f_iptables) and not filter(f_xinetd); };
cd /var/log
rm xinetd.log
rcsyslog restart (no ng here)
rcxinetd start
tail -5 messages
tail -5 xinetd.log
---------------------------------------------------------------------------------------
b) vi /etc/sysconfig/monitoring
IOSTAT_DELAY=2
MPSTAT_DELAY=2
VMSTAT_DELAY=2
a-d) cd ~/bin
vi monitoring
#!/bin/bash
source /etc/sysconfig/monitoring
cd /var/log
if [ $1 = 'start' ]
then
if [ -f iostat.log ]
then
rm iostat.log
fi
if [ -f mpstat.log ]
then
rm mpstat.log
fi
if [ -f vmstat.log ]
then
rm vmstat.log
fi
nohup iostat $IOSTAT_DELAY > iostat.log &
nohup mpstat $MPSTAT_DELAY > mpstat.log &
nohup vmstat $VMSTAT_DELAY > vmstat.log &
if [ $1 = 'stop' ]
then
kill `ps -a | grep iostat | awk '{print $1}'`
kill `ps -a | grep mpstat | awk '{print $1}'`
kill `ps -a | grep vmstat | awk '{print $1}'`
fi
chmod 700 monitoring ./monitoring start ./monitoring stop
No comments:
Post a Comment