
安静
1.yum groupinstall "GNOME Desktop" -y 2.systemctl get-default 3.systemctl set-default graphical.target 4.systemctl get-default 5.reboot
一. 安装dell omsa步骤: 1.安装net-snmp yum install net-snmp -y 2.安装dell 的yum 仓库 wget -q -O - http://linux.dell.com/repo/hardware/Linux_Repository_15.07.00/bootstrap.cgi | bash 3.安装管理包,因为网络原因这个安装过程会很慢很慢。(我先到一台美国的虚机上下载所有包,再复制到当前服务器上从本地安装会很快。) yum install srvadmin-all yum install compat-libstdc++-33 4.启动omsa /opt/dell/srvadmin/sbin/srvadmin-services.sh status /opt/dell/srvadmin/sbin/srvadmin-services.sh start 5.配置snmp vim /etc/snmp/snmpd.conf view all included .1 //添加此行 access omeGroup "" any noauth exact all none none //修改 omeGroup和all smuxpeer .1.3.6.1.4.1.674.10892.1 //添加此行 # sec.name source community com2sec omeUser 192.168.1.100 public-password //修改默认的用户名(sec.name),监控服务器IP(source,这里是ome服务器的IP), //修改密码(community,默认为public) com2sec public-passwordsec 192.168.1.100 public-password //修改第二项,注意后面有一点不同 trapsink 192.168.1.100 public-password //添加监控服务器的IP # groupName securityModel securityName group omeGroup v1 omeUser //修改默认的groupName和securityName group omeGroup v2c omeUser //修改默认的groupName和securityName 6.配置iptables iptables -I INPUT -s 192.168.1.100 -m multiport -p udp --dports 161,162 -j ACCEPT iptables -I INPUT -s 192.168.1.100 -p tcp --dport 1311 -j ACCEPT service iptables save 二. 安装dell ome步骤: 1.先到dell 技术支持网页上下载对应服务器型号的 dell openmanage essentials安装包 http://www.dell.com/support/home/cn/zh/cndhs1/Products/ 2.了解ome安装包支持的操作系统有哪些。我试过windows server 2008系统32位的直接不支持,64位的安装有问题,windows server 2012系统64位的安装没问题。 3.ome安装包下载完成后解压到一个文件夹,我直接解压到D盘的OME目录下,双击"autorun",先安装所有依赖包,再安装ome。 4.安装完成后登录ome平台。 5.在“管理”项,点击“查找和资源清册”,点击“添加查找范围”,在“查找范围配置”项找到"主机名",输入IP或域名,下一步,在“SNMP配置”项输入我们被监控服务器端设置的SNMP密码,比如,public-password,再下一步,如果omsa上的snmp配置正确,ome会自动把omsa添加。 6.在“管理”项,点击“设备”,再点击“Servers”,就可以看到添加成功的omsa服务器。
1.yum install mariadb-server mariadb 2.systemctl enable mariadb; systemctl start mariadb 3.mysql_secure_installation 4.mysql -u root -p mysql -e "SELECT User,Host FROM user" 5.mysql -u root -p 6.CREATE DATABASE db1 CHARACTER SET utf8 COLLATE utf8_general_ci; 7.SHOW DATABASES; 8.GRANT ALL ON db1.* to 'user1'@'localhost' IDENTIFIED BY 'redhat' WITH GRANT OPTION; 9.FLUSH PRIVILEGES; 10.EXIT 11.mysql -u user1 -p 12.SHOW DATABASES; note: 1. DROP DATABASE IF EXISTS db2; 2. GRANT ALL ON *.* TO 'user2'@'localhost' IDENTIFIED BY 'redhat' WITH GRANT OPTION; 3. SELECT HOST,USER FROM mysql.user WHERE USER='user1'; 4. SHOW GRANTS FOR 'user2'@'localhost'; 5. DROP USER 'user3'@'localhost'; 6. Allowing remote access to a MariaDB server: 1. firewall-cmd --permanent --add-service=mysql && firewall-cmd --reload 2. GRANT SELECT ON mysql.user TO 'joh'@'192.168.1.2' IDENTIFIED BY 'openbsd'; 3. FLUSH PRIVILEGES; EXIT; 4. mysql -u joh -p -h 192.168.1.1 mysql
1.yum install epel-release -y 2.yum install phpMyAdmin -y 3.cp /etc/httpd/conf.d/phpMyAdmin.conf /home/phpMyAdmin.conf.bak 4.sed -i "s,\(Require ip 127.0.0.1)\, \1\nRequire ip "192.168.31.100", g" /etc/httpd/conf.d/phpMyAdmin.conf 5.systemctl restart httpd 6.systemctl enable httpd 7.links http://192.168.31.100/phpmyadmin
备份数据库的策略: 1. 使用mysqldump定期完整备份每一个数据库; 2. 开启二进制日志定期增量备份每一个数据库。 恢复数据库的策略: 1. 使用mysql导入最后一次的完整备份。 2. 使用mysqlbinlog程序执行二进制日志中的语句。可以删除一些二进制日志中一些不需要的语句 。 ......
1.yum install epel-release -y 2.yum install php -y 3.systemctl start httpd 4.systemctl enable httpd 5.yum install nagios nagios-plugins-all -y 6.systemctl start nagios 7.systemctl enable nagios 8.htpasswd -cm /etc/nagios/cgi.cf 9.links http://192.168.31.100/nagios
1.mpstat Report processors related statistics. 2.iostat Report Central Processing Unit (CPU) statistics and input/out-put statistics for devices, partitions and network filesystems (NFS). 3.free Display amount of free and used memory in the system 4.netstat Print network connections, routing tables, interface statis-tics, masquerade connections, and multicast memberships 5.nmon nmon is designed for performance specialists to use for monitoring and analyzing performance data. ......
1.新加磁盘 2.格式化磁盘,标签改为8e(LVM) fdisk -cu /dev/vdb 3.创建物理卷 pvcreate /dev/vdb1 4.扩大卷组 vgextend vg1 /dev/vdb1 5.扩大逻辑卷 lvextend -l 100%free /dev/vg1/lv1 6.拉伸文件系统 resize2fs -p /dev/vg1/lv1
1.安装windows7 2.安装centos7 3.重启后直接进入centos7系统 4.问题:启动界面没有windows7启动项 5.解决方法: 6.yum install epel-release ntfs-3g -y 7.打开windows7 所在的磁盘分区 8.执行 df -h 命令, 找到 windows 7对应的磁盘分区。如,sda2, 则为hd0,1 (表示第一个磁盘上的第二个分区) 9.修改grub2.cfg vim /etc/grub2.cfg menuentry 'windows7'{ set root=(hd0,1) chainloader +1 } 10.重启系统 reboot
1.安装 yum install ntp -y 2.启动 systemctl start ntpd; systemctl enable ntpd 3.配置 vim /etc/ntp.conf #注释下面4行 server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst 替换成中国时间服务器: #http://www.pool.ntp.org/zone/cn server 0.cn.pool.ntp.org server 1.cn.pool.ntp.org server 2.cn.pool.ntp.org server 3.cn.pool.ntp.org 4.重启 systemctl restart ntpd
vmware虚拟机: CentOS7.4 1cpu,1核心 1G内存 一直停留在 Testing if puppet apply is finished: 192.168.31.104_controller.pp [ - ] 解决方法: 设置: 1cpu,2核心 4G内存
昨天的发的一篇博文,虚构一个邮件地址。 今天,就收到垃圾邮件。 堪称精准制邮!虚邮址!并真邮址! 想不通! 是谁?
1.ThinkPad E450 2.500G硬盘 3.windows10、CentOS7双系统。 4.分CentOS7 200G 5.windows10上vmware虚拟机太多,导致C、D、E盘空间全线吃紧。 6.进PE系统,各种乾坤大挪移,一下午。 7.重启系统。 8.磁盘在转,电源灯亮,屏幕黑的。 9.强关机。开机。问题8依然。 10.束手无策。 11.先冷静一下。希望出现奇迹。 12.奇迹没有出现。 13.欲哭无泪。 14.生活还是要继续。 15.一怒之下,拔掉所有外设(高清显示器、无线鼠标、机械键盘),准备重装系统。 16.屏幕亮了。
1.cd /home/ vim zabbix_send_mail.py #!/usr/bin/python # -*- coding:utf-8 -*- # http://www.cnblogs.com/hoods/p/6413330.html # http://blog.csdn.net/xiegh2014/article/details/76572556 # http://www.runoob.com/python/python-email.html # 感谢上面三位仁兄的源码。 # 各取一半一半,揉合之。 # 能达到获取图片与发送邮件的效果。 # 略粗糙,仅参考。 # 2017-10-24 # import HTMLParser import urlparse import urllib import urllib2 import cookielib import string import os import smtplib import datetime import cookielib, urllib2, urllib from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage host = "192.168.31.131" smtpserver = 'smtp.aliyun.com' mail_username = 'user1@aliyun.com' mail_password = 'redhat' receiver = 'user2@aliyun.com' #receiver = ['user3@aliyun.com', 'user4@aliyun.com'] # 如需多个收到邮件 Subject = Header('测试','utf-8') # 图片页面 hosturl = "http://192.168.31.131/chart2.php?graphid=796&period=3600" # post数据接收和处理的页面(我们要向这个页面发送我们构造的Post数据) posturl = "http://192.168.31.131/index.php" # 设置一个cookie处理器,它负责从服务器下载cookie到本地,并且在发送请求时带上本地的cookie cj = cookielib.LWPCookieJar() cookie_support = urllib2.HTTPCookieProcessor(cj) opener = urllib2.build_opener(cookie_support, urllib2.HTTPHandler) urllib2.install_opener(opener) # 打开图片页面(他的目的是从页面下载cookie,这样我们在再送post数据时就有cookie了,否则发送不成功) h = urllib2.urlopen(hosturl) # 构造header,一般header至少要包含一下两项。 # 抓包得到。 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0', 'Referer': 'http://192.168.31.131/zabbix.php?action=dashboard.view'} # 构造Post数据。 # 抓包得到。 postData = { 'name': 'Admin', # 用户名 'password': 'zabbix', # 密码 'autologin': 1, 'enter': 'Sign in' } # 需要给Post数据编码 postData = urllib.urlencode(postData) # 通过urllib2提供的request方法来向指定Url发送我们构造的数据,并完成登录过程 request = urllib2.Request(posturl, postData, headers) response = urllib2.urlopen(request) text = response.read() def get_graph(host, graphid, period, image_name): path = "/tmp/test/" #zabbix的图片的地址的构造 url = "http://%s/chart2.php?graphid=%s&period=%s" % (host, graphid, period) img_req = urllib2.Request(url) png = urllib2.urlopen(img_req).read() file = path + image_name + '.png' with open(file,'wb') as f: f.write(png) def SendMail(receiver, Subject, smtpserver, mail_username, mail_password): msgRoot = MIMEMultipart('related') msgRoot['Subject'] = Subject msgRoot['From'] = ("%s<youyou12@aliyun.com>") % (Header('testt!!!', 'utf-8'),) sendText = '<b>Some <i>HTML</i> text</b> and an image.<br><img src="cid:image1"><br>' msgText = MIMEText(sendText, 'html', 'utf-8') msgRoot.attach(msgText) fp = open('/tmp/test/cpu_load.png', 'rb') msgImage = MIMEImage(fp.read()) fp.close() msgImage.add_header('Content-ID', '<image1>') msgRoot.attach(msgImage) smtp = smtplib.SMTP() smtp.connect(smtpserver) smtp.login(mail_username, mail_password) smtp.sendmail(mail_username, receiver, msgRoot.as_string()) smtp.quit() get_graph(host, 796, 3600, 'cpu_load') SendMail(receiver, Subject, smtpserver, mail_username, mail_password) 2.mkdir /tmp/test/ 3.python zabbix_send_mail.py 4.ls /tmp/test/ # 图片获取成功 cpu_load.png 5.查看邮件 # 成功收到邮件
1.启动 zabbix-server失败 2.查看日志tailf /var/log/zabbix/zabbix_server.log报错信息:zabbix_server [4569]: cannot open log: cannot create semaphore set: [28] No space left on device 3.sysctl -a | grep kernel.semkernel.sem = 250 32000 32 128 4.echo "kernel.sem = 500 64000 64 256" >> /etc/sysctl.conf 5.sysctl -p 6.sysctl -a | grep kernel.sem 7.systemctl start zabbix-server # 成功 8.systemctl status zabbix-server
一. 监控linux服务器: 1.yum -y install wget 2.下载与安装zabbix仓库 wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release- 3.4-2.el7.noarch.rpm yum localinstall zabbix-release-3.4-2.el7.noarch.rpm 3.安装Zabbix agent yum -y install zabbix-agent 4.修改zabbix agent配置文件vim /etc/zabbix/zabbix_agentd.confServer=127.0.0.1 # 指定zabbix server的IP地址 5.启动zabbix agent服务systemctl start zabbix-agent; systemctl enable zabbix-agent 6 在zabbix web添加 linux服务器 二. 监控windows服务器 1.下载windows版本的zabbix agenthttps://www.zabbix.com/downloads/3.4.0/zabbix_agents_3.4.0.win.zip 2.解压zabbix-agent,进conf目录,编辑zabbix_agentd.conf配置文件,指定Server为zabbix-server的IP地址。 3.将zabbix_agentd.conf配置文件拷贝到c:目录下 4.安装zabbix-agent 5.启动zabbix agent 6.在zabbix web添加 windows服务器
如果,我的字能帮到你,我很高兴。
1. 最小安装CentOS7 2. 开启网卡 sed -i "s/ONBOOT=no/ONBOOT=yes/" /etc/sysconfig/network-scripts/ifcfg-ens33 3. 重启网络服务 systemctl restart network 4. 安装vim yum -y install vim 5. 安装epel仓库 yum -y install epel-release 6. 更新系统 yum -y update [root@test ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) 7. 设置主机名 echo "test.zeng.com" > /etc/hostname 8. 关闭SELINUX setenforce 0 sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux 9. 关闭firewalld(仅测试环境) systemctl stop firewalld systtemctl disable firewalld 10. 重启系统 reboot 11. yum -y install wget 12. 下载与安装zabbix和mysql仓库 wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm yum localinstall zabbix-release-3.4-2.el7.noarch.rpm yum localinstall mysql57-community-release-el7-11.noarch.rpm 13. 安装LAMP yum -y install php mysql-server 14. 启动mysqld服务 systemctl start mysqld; systemctl enable mysqld 15. 找到mysql默认root密码 grep password /var/log/mysqld.log 16. mysql安全初始化 mysql_secure_installation 17. 安装Zabbix yum -y install zabbix-server-mysql zabbix-web-mysql 18. 导入zabbix数据库 cd /usr/share/doc/zabbix-server-mysql-3.4.1/ gzip -d create.sql.gz mysql -u root -p create database zabbix character set utf8 collate utf8_bin; # 创建zabbix数据库 grant all privileges on zabbix.* to zabbix@localhost identified by 'redhat' with grant option; # 赋权限 use zabbix; source create.sql; # 导数据 flush privileges; exit; 19. 设置php时区 vim /etc/php.ini date.timezone = Asia/Shanghai 20. 启动httpd服务 systemctl start httpd; systemctl enable httpd 21. 修改zabbix_server配置文件 vim /etc/zabbix/zabbix_server.conf DBPassword=redhat # 只需取消此行注释,并输入zabbix数据库密码 22. 启动zabbix服务 systemctl start zabbix-server; systemctl enable zabbix-server 23. 查看监听端口 netstat -antupl 24. 将页面语言设置为中文后,图形显示会有乱码,此时需为zabbix web更换中文字体。 25. 找到字体存放目录 find / -name fonts cd /usr/share/zabbix/fonts 26. 在C:\Windows\Fonts目录下找到喜欢的字体,如微软雅黑(简体中文),拷贝到 /usr/share/zabbix/fonts 27. 重命名字体 cp graphfont.ttf graphfont.ttf.bak cp MSYHBD.TTC graphfont.ttf 28. 重启zabbix服务 systemctl restart zabbix-server 29. 访问zabbix web http://127.0.0.1/zabbix 默认用户名: Admin 默认密码: zabbix
1.登录百度网盘提示 "由于系统限制了文件目录的读/写权限,程序将会退出,......" 2. 查看权限,确实是空。 3. 那我就跳过 Program Files (x86),尝试安装到 D盘根目录下 4. 再次登录。好了。
1.在登录界面按下任意键中暂停引导 2.按E键进编辑模式 3.找到linux16开头的一行,end键定位到行尾,输入rd.break,在系统挂载文件系统之前中断引导过程。 4.查看文件系统 ls /sysroot 5.以读写模式重新挂载 mount -o remount, rw /sysrootchroot /sysroot 6.重置root密码passwd 7.如果系统之前没有运行SELinux, exit重新引导 8.如果系统之前运行SELinux,下次引导时给所有文件重新标签touch /.autorelabelexitexit
新的开始。