linux
文章平均质量分 90
鑫酉
坚持努力
展开
-
Linux的防火墙基础操作
动态防火墙后台程序firewalld提供了一个动态管理的防火墙,用以支持网络“zones",以分配对一个网络及其相关链接和界面一定程度的信任。它具备对IPV4和IPv6防火墙设置的支持。它支持以太网桥,并有分离运行时间和永久性配置选择。它还具备一个通向服务或者应用程序以直接增加防火墙规则的接口。系统提供了图像化的配置工具firewall-config、system-config-firewall,...原创 2018-12-19 14:39:04 · 153 阅读 · 0 评论 -
shell的信号捕捉trap
[root@localhost mnt]# trap “echo hello” 2[root@localhost mnt]# ^Chello原创 2019-01-10 21:16:35 · 122 阅读 · 0 评论 -
xargs命令
[root@localhost mnt]# cat test1 2 3 4 56 7 8 9 10[root@localhost mnt]# cat test | xargs1 2 3 4 5 6 7 8 9 10[root@localhost mnt]# cat test | xargs -n21 23 45 67 89 10[root@localhost mnt]# ca...原创 2019-01-10 21:28:54 · 296 阅读 · 0 评论 -
shell的函数基础知识
方法一: 函数名() { 函数体 return n }方法二: function 函数名() { 函数体 return n }原创 2019-01-10 22:49:30 · 176 阅读 · 0 评论 -
shell中函数练习题
1)跳板机#!/bin/bashfunction trapper() { trap "" INT EXIT TSTP TERM HUP}function main() {while truedo trapper clear cat <<me原创 2019-01-10 22:55:47 · 557 阅读 · 0 评论 -
python3.6的基础知识
1.python基础知识语法:1.没有分号2.严格按照缩进的语言#coding:utf-8print(‘hhh’)注释:单行注释#单行多行注释“”"多行注释“”"2.python3.6与python2的不同1)字符类型不同python3.6的字符类型有:int、float、str、booleanstr:原创 2019-01-17 11:17:57 · 923 阅读 · 0 评论 -
shell的数组基础知识
1.数组的定义方法方法一:[root@localhost ~]# array=(a b ca)[root@localhost ~]# echo ${array[*]}a b ca方法二:[root@localhost ~]# array=([0]=zero [1]=one [2]=two [3]=three)[root@localhost ~]# echo ${array[*]}...原创 2019-01-09 13:56:50 · 177 阅读 · 0 评论 -
linux中python、ipthon、pycharm的安装和使用
[root@localhost mnt]# lsPython-3.6.6.tgz[root@localhost mnt]# tar zxf Python-3.6.6.tgz [root@localhost mnt]# lsPython-3.6.6 Python-3.6.6.tgz[root@localhost mnt]# cd Python-3.6.6/[root@localhost...原创 2019-01-16 21:56:00 · 222 阅读 · 0 评论 -
lvs负载均衡的NAT模式
实验前提server1:172.25.55.1(搭建yum源头,下载好ipvsadm)server2:172.25.55.2(下载httpd,编辑网页)server3:172.25.55.3(下载httpd,编辑网页) 打开内核路由功能[root@server1 ~]# vim /etc/sysctl.confnet.ipv4.ip_forward = 1[root@server1 ...原创 2019-02-15 00:24:16 · 116 阅读 · 0 评论 -
shell中rsyncd的脚本和数据库备份脚本的编写
[root@localhost mnt]# cat rsyncd.sh #!/bin/bash. /etc/init.d/functionsfunction usage() { echo $"usage:$0 {start|stop|restart}" exit 1}function start() { rsync --daemon sleep 1.原创 2019-01-10 22:52:51 · 115 阅读 · 0 评论 -
shell中随机数练习题
随机数练习题1)使用for循环在/westos目录下批量创建10个html文件其中每个文件需要包含10个随即小写字母加固定字符串westos#!/bin/bashPath=/westos[ -d "$Path" ] || mkdir -p $Pathfor i in `seq 10`do random=$(openssl rand -base64 40 | sed 's/[^...原创 2019-01-10 18:36:10 · 408 阅读 · 0 评论 -
pxe环境的构建
将镜像目录下的isolinux目录下的文件都复制到/var/lib/tftpboot下载httpd system-config-kickstartvim /var/www/html/ks.cfg原创 2018-12-19 14:40:00 · 717 阅读 · 0 评论 -
iptables防火墙的设置
在做此实验时,要将firewalld关掉。[root@localhost yum.repos.d]# systemctl stop firewalld[root@localhost yum.repos.d]# systemctl mask firewalld[root@localhost yum.repos.d]# systemctl disable firewalls[root@loca...原创 2018-12-19 18:03:49 · 128 阅读 · 0 评论 -
编写一个httpd监控脚本
编写httpd监控脚本,要求可以输入start|stop|restart|status[root@localhost mnt]# vim httpd.sh #!/bin/bash while true do echo -e " \033[31m A 打开 \033[0m \033[32m B 关闭 \033[0m \03...原创 2018-12-26 14:50:40 · 301 阅读 · 0 评论 -
linux下shell的基础操作
[root@localhost mnt]# vim test1.sh[root@localhost mnt]# sh test1.shhello[root@localhost mnt]# bash test1.shhello[root@localhost mnt]# /mnt/test1.sh-bash: /mnt/test1.sh: Permission denied[root...原创 2018-12-25 22:00:31 · 180 阅读 · 0 评论 -
Linux中sed和awk语句的使用
1.sedsed:stream editor :一次处理一行内容,处理时,把当前的行存储在临时缓冲区,处理完后,输送到屏幕sed [参数] ‘命令’ file参数含义p显示d删除a添加c替换i插入1)p2)d3)a4)c5)i插入6)-i:改变原文件内容awk报告生成器awk处理机制:根据模式...原创 2018-12-25 22:02:49 · 285 阅读 · 0 评论 -
shell中if语句,循环语句
1.if语句if单分支语句统计登录shell为bash的用户if双分支语句统计uid小于等于500和大于500的用户个数if-else语句 [root@localhost mnt]# vim if-else.sh #!/bin/bash read -p "请输入用户名" user if grep $user /etc/passwd;then ...原创 2018-12-25 22:04:11 · 17534 阅读 · 1 评论 -
linux:安装linux6.5
安装完成修改主机名称:vi /etc/sysconfig/network设置网络(如果要做快照虚拟机将网卡那一行内容删除)重启网络:service network restart设置内核级防火墙:vi /etc/selinux/config添加域名解析: vi /etc/hosts设置yum源:vi /etc/yum.repo/rhel-source...原创 2019-02-07 22:38:38 · 879 阅读 · 0 评论 -
RHCS套件HA与mysql+GFS2文件系统实现同步存储
实验背景:虚拟机ipserver1172.25.55.1server2172.25.55.2server3172.25.55.3三台虚拟机都关闭iptables和内核级防火墙。三台虚拟机都做了相互的域名解析。第一步:HA添加集群和fence可查看上一篇博客第二步:共享存储为sever3添加一块磁盘要安装的软件[root@server1 ...原创 2019-02-21 22:17:08 · 452 阅读 · 1 评论 -
lnmp---mariadb的源码安装与配置
lnmp(linux,nginx,mariadb,php)[root@server1 ~]# lsanaconda-ks.cfg install.log mysql-5.7.17cmake-2.8.12.2-4.el6.x86_64.rpm install.log.syslog mysql-boost-5.7.17.tar.gz[roo...原创 2019-02-21 22:34:36 · 331 阅读 · 0 评论 -
DR模式+keepalived(高可用)
实验前提DR模式配置完成,详见(点击)实验操作 [root@server1 html]# cd /mnt[root@server1 mnt]# lskeepalived-2.0.6.tar.gz varnish-3.0.5-1.el6.x86_64.rpmldirectord-3.9.5-3.1.x86_64.rpm varnish-libs-3.0.5-1.el6...原创 2019-02-13 23:23:16 · 296 阅读 · 0 评论 -
haproxy(使用RPM工具创建安装包、动态轮询、网页自动更新、添加日志、限制访问、动静分离、读写分离)
一、实验环境:server1:172.25.55.1(rhel7.3虚拟机,关闭防火墙与内核级防火墙)server2:172.25.55.2(rhel7.3虚拟机,关闭防火墙与内核级防火墙,下载httpd便编辑好网页文件)server3:172.25.55.3(rhel7.3虚拟机,关闭防火墙与内核级防火墙,下载httpd便编辑好网页文件)二、使用RPM工具创建haprox安装包[roo...原创 2019-03-01 12:56:00 · 790 阅读 · 1 评论 -
nginx的平滑升级(热部署)
[root@foundation55 yum.repos.d]# yum install libguestfs-tools-c.x86_64 -y[root@foundation55 yum.repos.d]# virt-sysprep -d base[root@server1 nginx-1.14.2]# vim auto/cc/gcc # debug#CFLAGS="$CFLAGS...原创 2019-03-01 12:57:24 · 301 阅读 · 1 评论 -
编写Nginx的systemctl脚本
由于Nginx与httpd服务有些类似,所以我们以httpd服务的脚本来做修改。[root@server1 system]# cd /usr/lib/systemd/system[root@server1 system]# cp httpd.service /etc/systemd/system/nginx.service[root@server1 system]# vim /etc/sy...原创 2019-03-01 12:57:58 · 725 阅读 · 0 评论 -
nginx的负载均衡和健康检查
[root@server1 nginx-1.15.7]# vim src/core/nginx.h 14 #define NGINX_VER "nginx/" (去掉nginx版本,防止被攻击) [root@server1 nginx-1.15.7]# vim auto/cc/gcc 171 # debug 172 #CFLAGS="$CFLAGS -g"(注释debu...原创 2019-02-25 21:50:28 · 1085 阅读 · 1 评论 -
lnmp----添加缓存(memcache)
MemCache是分布式的高速缓存系统,通过缓存来分担数据库的压力。解压memcache包:[root@server1 ~]# tar zxf memcache-2.2.5.tgz [root@server1 ~]# cd memcache-2.2.5添加环境变量:[root@server1 memcache-2.2.5]# vim ~/.bash_profile PATH=$PAT...原创 2019-02-25 22:18:50 · 344 阅读 · 1 评论 -
lnmp----openresty外部存储
[root@server1 conf]# nginx -s stop[root@server1 openresty-1.13.6.1]# tar zxf openresty-1.13.6.1.tar.gz [root@server1 openresty-1.13.6.1]# cd openresty-1.13.6.1[root@server1 openresty-1.13.6.1]# ./...原创 2019-02-26 22:54:50 · 143 阅读 · 0 评论 -
lvs的DR模式的健康检测(DR+ ldirectord)
实验前提DR模式配置完成,详见(点击)实验步骤server1:[root@server1 ~]# cd /mnt[root@server1 mnt]# lsldirectord-3.9.5-3.1.x86_64.rpm varnish-libs-3.0.5-1.el6.x86_64.rpmvarnish-3.0.5-1.el6.x86_64.rpm[root@server1 mn...原创 2019-02-13 21:32:57 · 193 阅读 · 0 评论 -
Lvs的TUN模式(隧道模式)
实验前提:server1:172.25.55.1搭建yum源,下载httpd,ipvsadm(下载ipvsadm要添加安装库,详见点击)server2:172.25.55.2搭建yum源头,下载httpd,编辑网页server3:172.25.55.3搭建yum源头,下载httpd,编辑网页实验操作server1:[root@server1 ~]# modprobe ipip...原创 2019-02-13 17:58:22 · 233 阅读 · 0 评论 -
lnmp---php的源码安装与配置
编译、安装[root@server1 ~]# ls php-5.6.35.tar.bz2[root@server1 ~]# tar jxf php-5.6.35.tar.bz2 [root@server1 ~]# cd php-5.6.35[root@server1 php-5.6.35]# ./configure --prefix=/usr/local/lnmp/php --with...原创 2019-02-21 22:41:34 · 353 阅读 · 0 评论 -
lnmp---nginx的源码安装与配置
编译、安装 [root@server1 ~]# ls nginx-1.14.0.tar.gz[root@server1 ~]# tar zxf nginx-1.14.0.tar.gz [root@server1 ~]# cd nginx-1.14.0[root@server1 nginx-1.14.0]# vim src/core/nginx.h 14 #defi...原创 2019-02-21 22:48:29 · 256 阅读 · 0 评论 -
lnmp----搭建论坛
将论坛压缩包解压[root@server1 ~]# ls Discuz_X3.2_SC_UTF8.zip [root@server1 html]# unzip Discuz_X3.2_SC_UTF8.zip -d /usr/local/lnmp/nginx/html/[root@server1 nginx]# cd /usr/local/lnmp/nginx/...原创 2019-02-21 23:05:07 · 403 阅读 · 0 评论 -
CDN-----varnish的原理、操作
vim /etc/sysconfig/varnishsysctl -a | grep filevim /etc/security/limits.conf文件vim /etc/varnish/default.vcl backend default { .host = "172.25.28.2"; .port = "80"; }查看用户进程内容,root只有...原创 2019-02-12 00:17:06 · 117 阅读 · 0 评论 -
CDN-----varnish的CDN推送管理平台
六、CDN推送管理[root@server1 ~]# yum install httpd unzip php -y[root@server1 html]# scp -r [email protected]:'/home/kiosk/Desktop/python10and 企业/bansys.zip' . [root@server1 html]# lsbansys.zip[root@...原创 2019-02-12 00:43:25 · 339 阅读 · 0 评论 -
nginx+tomcat+memcache的负载均衡
解压安装包(jdk、tomcat) [root@server1 sbin]# cd [root@server1 ~]# tar zxf jdk-7u79-linux-x64.tar.gz -C /usr/local [root@server1 ~]# tar zxf apache-tomcat-7.0.37.tar.gz -C /usr/local添加环境变量 ...原创 2019-02-27 20:11:33 · 196 阅读 · 0 评论 -
nginx+tomcat:Session共享
[root@server1 ~]# lsnginx-1.10.1.tar.gz test.jsp [root@server1 ~]# cp test.jsp /usr/local/tomcat/webapps/ROOT/[root@server1 ~]# scp test.jsp [email protected]:/usr/local/tomcat/webapps/...原创 2019-02-27 21:44:32 · 1139 阅读 · 0 评论 -
lvs的DR模式
添加yum源[root@server1 yum.repos.d]# vim rhel-source.repo [rhel-source] name=Red baseurl=http://172.25.55.250/wanggua1 gpgcheck=0 [LoadBalancer] name=kk baseurl=http://172.25.55.250/wanggua1/...原创 2019-02-13 17:01:18 · 179 阅读 · 0 评论 -
mysql的读写分离(使用mysql-proxy)
实验准备:Server1 (主库):172.25.55.1(安装好mysql)Server2 (备库):172.25.55.2(安装好mysql)Server3 (代理端):172.25.55.3Client :172.25.55.250一、建立主从复制[root@server1 ~]# vim /etc/my.cnf server-id=1log-bin=mysql-bin...原创 2019-03-15 21:52:04 · 183 阅读 · 0 评论 -
Linux的正向代理、反向代理
cdnCDN的全称是Content Delivery Network,即内容发布网络。(1)正向代理设置server虚拟机网络设置如下:真机上设置如下:此时server虚拟机有网了,可以访问百度。配置好yum源后下载软件 squid编辑其配置文件在desktop虚拟机上,关闭虚拟机,并设置浏览器Edit下的preferences,如下图:此时没有网络的desktop...原创 2018-12-06 09:14:23 · 216 阅读 · 0 评论 -
linux文件管理
linux文件管理与文件路径1.新建文件与目录touch file1 file2… 新建文件时可以一次建立多个文件,我们要注意touch默认用来建立文件,同时此命令还可用来修改文件时间戳。...原创 2018-10-06 19:39:34 · 638 阅读 · 0 评论