系统环境:
全新的debin8,中科大的源
快速部署通用的lamp
apt-get install -y apache2 php5 mysql-server php5-mysql unzip vim service mysql restart service apache2 restart echo ‘<?php echo mysql_connect(‘localhost‘,‘root‘,‘your_mysql_password‘)?"success":"fail";echo phpinfo(); ?>‘ > /var/www/html/index.php
访问测试 http://your_server_ip/index.php
基于lamp快速部署itop所需环境
apt-get install -y php5 php5-mysql php5-ldap php5-mcrypt php5-cli php5-json graphviz php5-gd curl apt-get install -y ldap-utils openssl libpam-ldap service apache2 restart
下载itop最新版
wget https://sourceforge.net/projects/itop/files/latest/download
解压
mv download itop.zip unzip itop.zip mv web/* /var/www/html/
创建itop依赖环境
cd /var/www/html mkdir log mkdir env-production mkdir conf mkdir data chown -R www-data: ./*
开启ssl
a2enmod ssl a2ensite default-ssl service apache2 restart
开始安装,浏览器访问
https://your_server_ip/
安装完成之后,立即备份数据库,网页文件
cd /var/www/html;mysqldump -p --databases itop_2_2_1 > itop_2_2_1.sql cd /var/www/;tar -zcf html_itop_2_2_1.tar.gz html/ cd /var/www/html;rm -rf itop_2_2_1.sql mv html_itop_2_2_1.tar.gz /home/
修改root密码
[email protected]:/var/www/html# passwd root [email protected]:/var/www/html# mkdir -pv /root/.ssh [email protected]:/var/www/html# echo "我的key" > /root/.ssh/authorized_keys [email protected]:/var/www/html# exit [email protected]:~$ exit
从工作机登录itop服务器
ssh [email protected] userdel -r 系统初始安装时创建的user
不允许root用密码登录
grep PermitRootLogin /etc/ssh/sshd_config PermitRootLogin without-password # the setting of "PermitRootLogin without-password".
iptables 规则,只允许22,80,443
iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A INPUT -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -p tcp --sport 443 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT DROP iptables -L -n
保存iptables的规则到文件
iptables-save > /etc/iptables.up.rules
开机自动加载iptables 规则
vim /etc/init.d/start-iptables #! /bin/sh iptables-restore < /etc/iptables.up.rules chmod +x /etc/init.d/start-iptables
时间: 2024-10-11 05:54:06