unissoft-bj / microma

micro website for meeting affaires
0 stars 0 forks source link

汽安展 安装过程 #63

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

复制命令时,进入页面的 raw 模式

安装文件:

apt-get install -y apache2 apache2-doc apache2-utils dos2unix apt-get install -y libapache2-mod-php5 php5 php-pear php5-xcache apt-get install -y php5-fpm php-apc php5-mysql php5-curl

确认安装

apt-get install -y apache2 apt-get install -y libapache2-mod-php5 a2enmod php5 apt-get install -y mysql-server apt-get install -y libapache2-mod-auth-mysql apt-get install -y php5-mysql

wget https://launchpad.net/ubuntu/+source/mod-auth-mysql/4.3.9-13ubuntu3/+build/2965774/+files/libapache2-mod-auth-mysql_4.3.9-13ubuntu3_armhf.deb dpkg -i libapache2-mod-auth-mysql_4.3.9-13ubuntu3_armhf.deb

wget http://launchpadlibrarian.net/101369001/php5-mysql_5.3.10-1ubuntu3_armhf.deb dpkg -i php5-mysql_5.3.10-1ubuntu3_armhf.deb

修改数据库root密码

echo "update user set password=password('rootatussp') where user='root';" | mysql -uroot -p0ffs4t? mysql echo "FLUSH PRIVILEGES; "| mysql -uroot -p0ffs4t? mysql

准备www站点

mkdir /var/www echo "hello" > /var/www/index.html echo "<?php phpinfo(); ?>" > /var/www/test.php

cat >> /etc/apache2/sites-available/wlsite << EOF <VirtualHost *:80> ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

EOF

unlink /etc/apache2/sites-enabled/000-default ln -sf /etc/apache2/sites-available/wlsite /etc/apache2/sites-enabled/000-default

service apache2 stop service apache2 start

no internet link

sed -i 's|#address=/#/172.16.0.1|address=/#/1.1.1.1|g' /etc/dnsmasq.conf

push url

sed -i 's|HS_UAMFORMAT=http://\$HS_UAMLISTEN:\$HS_UAMUIPORT/www/ihome.html|HS_UAMFORMAT=http://mtxwifi.net/wap/index.php|g' /etc/chilli/defaults

mv /var/www /var/www.old cd /root git clone -b qianzhan https://github.com/unissoft-bj/microma.git cp -r ./microma/webpages /var/www chmod -R 777 /var/www

database

git clone https://github.com/unissoft-bj/ihost.git cd ihost git log git reset --hard fe24ba5b9a585af608b6ae08d0f856ffd590163e

HEAD is now at fe24ba5 admin page for local dns

wlsp

1, 创建数据库wlsp

2, 创建表结构(base.sql为基本表.ihost.sql为ihost上的视图、触发器(iserver不用))

3, 创建数据库用户

预置root远程访问sql server的权力

echo "create database wlsp;" | mysql -uroot -prootatussp mysql -uroot -prootatussp wlsp < /usr/src/ihost/db.schema/wlsp.sys.base.sql mysql -uroot -prootatussp wlsp < /usr/src/ihost/db.schema/wlsp.sys.ihost.sql mysql -uroot -prootatussp wlsp < /usr/src/ihost/db.schema/wlsp.sys.users.sql echo "GRANT ALL PRIVILEGES ON . TO root@'%' IDENTIFIED BY 'rootatussp'; " | mysql -uroot -prootatussp echo "GRANT ALL PRIVILEGES ON . TO 'root'@'%'WITH GRANT OPTION; " | mysql -uroot -prootatussp echo "FLUSH PRIVILEGES; "| mysql -uroot -prootatussp

ma

mysql -uroot -prootatussp wlsp < /usr/src/microma/db/ihost-ma.sql

wenjuan

mysql -uroot -prootatussp wlsp < /usr/src/microma/db/wenjuan.sq.sql

news

mysql -uroot -prootatussp wlsp < /usr/src/microma/db/ma_news.sql

blink led

nano /root/blink.sh

!/bin/bash

workingLED=55 echo out > /sys/class/gpio/gpio${workingLED}/direction while true do echo 1 > /sys/class/gpio/gpio${workingLED}/value usg=$(top -bn 1 | awk '{print $9}' | tail -n +8 | awk '{s+=$1} END {print s}') tmp=$(($usg / 20)) iusg=$(( $tmp + 1 )) intvl=$(echo $iusg | awk '{printf "%.3f \n", 1/$usg}') echo 0 > /sys/class/gpio/gpio${workingLED}/value sleep $(echo $intvl | awk '{printf "%.3f \n", $intvl/1}') done

echo "@reboot sudo bash /root/blink.sh &" >> /var/spool/cron/crontabs/root

load record, excute every minute

cat >> /root/record_top.sh << EOF while :; do

echo "=============================" >> /root/top.txt
date >> /root/top.txt
echo "-----------------------------" >> /root/top.txt
top -n 1 -b | head -15 >> /root/top.txt
echo "-----------------------------" >> /root/top.txt
chilli_query list >> /root/top.txt
sleep 10

done

EOF

echo "@reboot sudo bash /root/record_top.sh " >> /var/spool/cron/crontabs/root

echo "/1 * * * \ sudo bash /root/record_top.sh " >> /var/spool/cron/crontabs/root

privilege for timeset & reboot

echo "www-data ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

把地址池压缩为100个

sed -i 's|HS_DYNIP=172.16.0.100|HS_DYNIP=172.16.255.150|g' /etc/chilli/default

ip地址租期 300 seconds

echo 'lease=300' >> /etc/chilli.conf

performance

echo "http://mtxwifi.net/wap/index.php?res=notyet&uamip=172.16.0.1&uamport=3990&challenge=f758f7e826849a06ebec67237266938a&called=00-C0-08-88-25-6C&mac=00-1B-77-1C-92-55&ip=172.16.0.100&nasid=nas01&sessionid=553ece3200000001&userurl=http%3a%2f%2fwww.baidu.com%2f&md=F1C2BCA0387213B816E832C46F681847" >> urlphp.txt echo "http:/192.168.100.200/wap/index.php?res=notyet&uamip=172.16.0.1&uamport=3990&challenge=f758f7e826849a06ebec67237266938a&called=00-C0-08-88-25-6C&mac=00-1B-77-1C-92-55&ip=172.16.0.100&nasid=nas01&sessionid=553ece3200000001&userurl=http%3a%2f%2fwww.baidu.com%2f&md=F1C2BCA0387213B816E832C46F681847" >> urlphp.txt http:/192.168.100.200/wap/index.php?res=notyet&uamip=172.16.0.1&uamport=3990&challenge=f758f7e826849a06ebec67237266938a&called=00-C0-08-88-25-6C&mac=00-1B-77-1C-92-55&ip=172.16.0.100&nasid=nas01&sessionid=553ece3200000001&userurl=http%3a%2f%2fwww.baidu.com%2f&md=F1C2BCA0387213B816E832C46F681847

http_load -parallel 200 -fetches 10000 urlphp.txt

(19:48 root@ihost ~) > df -Th Filesystem Type Size Used Avail Use% Mounted on rootfs ext3 6.4G 4.0G 2.2G 65% / devtmpfs devtmpfs 437M 4.0K 437M 1% /dev none tmpfs 88M 2.6M 85M 3% /run none tmpfs 5.0M 0 5.0M 0% /run/lock none tmpfs 438M 100K 437M 1% /run/shm /dev/mmcblk0p2 ext3 8.3G 48M 7.8G 1% /wms (20:06 root@ihost ~) >