CentOS 笔记

批量杀光进程

ps -ef | grep chrome | grep -v grep | awk '{print $2}' | xargs kill -9

https://blog.csdn.net/weiyichenlun/article/details/59108463

查看已开放的端口

sudo firewall-cmd --list-ports

查看防火墙状态。
systemctl status firewalld

临时关闭防火墙命令。重启电脑后,防火墙自动起来。
systemctl stop firewalld

开启
systemctl start firewalld

永久关闭防火墙命令。重启后,防火墙不会自动启动。
systemctl disable firewalld

打开防火墙命令。
systemctl enable firewalld

  1. 查看想开的端口是否已开 # firewall-cmd --query-port=666/tcp 提示no表示未开
  2. 开永久端口号 firewall-cmd --add-port=666/tcp --permanent 提示 success 表示成功
  3. 重新载入配置 # firewall-cmd --reload 比如添加规则之后,需要执行此命令
  4. 再次查看想开的端口是否已开 # firewall-cmd --query-port=666/tcp 提示yes表示成功
  5. 若移除端口 # firewall-cmd --permanent --remove-port=666/tcp

CentOS 7 快速安装 Chrome 浏览器

第一步: 执行如下命令:

cd /etc/yum.repos.d/

第二步:命令如下:

创建一个repo文档

vim google-chrome.repo

第三步:命令如下:

把下列代码粘贴即可

[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub

第四步:命令如下:

yum -y install google-chrome-stable即可。

由于墙的存在,有可能执行不成功,请使用如下命令替换上述命令:

yum -y install google-chrome-stable --nogpgcheck

上述安装方式,是目前安装 Chrome最为快捷的方式,避免了下载 Chrome安装包的麻烦。

更新Chrome

执行wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm下载最新Linux的chrome
下载之后执行sudo yum localinstall google-chrome-stable_current_x86_64.rpm安装本地的rpm包则会替换之前版本的chrome

创建桌面快捷方式

[Desktop Entry]
Encoding=UTF-8
Name=Pycharm
Comment=pycharm-2020.2
Exec=/home/xiaojia.chen/MyApplications/pycharm-2020.1.4/bin/pycharm.sh
Icon=/home/xiaojia.chen/MyApplications/pycharm-2020.1.4/bin/pycharm.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;

Centos7安装Python3.7详细教程

https://blog.csdn.net/xuezhangjun0121/article/details/103903984

Centos7安装Teamviewer

yum install epel-release

wget https://download.teamviewer.com/download/linux/teamviewer-host.x86_64.rpm
yum install ./teamviewer-host*.rpm

卸载rpm

[root@localhost \u4e0b\u8f7d]# rpm -q teamviewer-host
teamviewer-host-15.7.6-0.x86_64
[root@localhost \u4e0b\u8f7d]# rpm -e team
teamd teamviewer-host
[root@localhost \u4e0b\u8f7d]# rpm -e teamviewer-host

使用Squid 配置成代理服务器

yum install -y squid
vi /etc/squid/squid.conf
修改成 http_access allow all 和 http_port xxx

ubuntu安装/卸载Squid:apt-get install -y squid apt-get remove -y squid

# 启动
service squid start
# 停止
service squid stop
# 重启
service squid restart
# 重新加载配置文件
service squid reload
# 查看是否正在运行
service squid status

Squid 配置高匿代理

上面方式搭建的代理服务器仅为普通代理,目标网站依然能检测到我们的真实ip,实际的爬虫业务中我们需要的是高匿代理,隐藏爬虫的真实ip。

实现方法比较简单,只需要将如下配置加入到配置文件/etc/squid/squid.conf末尾即可。

request_header_access Via deny all
request_header_access X-Forwarded-For deny all
request_header_access From deny all

重新加载配置文件: squid -k reconfigure
可以访问 http://httpbin.org/ip ,如果仅返回squid服务器ip,则表明高匿生效。

后台运行

/dev/null : 在类Unix系统中,/dev/null,或称空设备,是一个特殊的设备文件,它丢弃一切写入其中的数据(但报告写入操作成功),读取它则会立即得到一个EOF。
在程序员行话,尤其是Unix行话中,/dev/null 被称为位桶(bit bucket)或者黑洞(black hole)。空设备通常被用于丢弃不需要的输出流,或作为用于输入流的空文件。这些操作通常由重定向完成。

不保存输出日志:

nohup python3 -u parse_url.py > /dev/null 2>&1 &
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值