cisen / blog

Time waits for no one.
130 stars 20 forks source link

centos使用相关 #406

Open cisen opened 5 years ago

cisen commented 5 years ago

注意

DHCP分配IP上网

修改出口端口

1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。 启动一个服务:systemctl start firewalld.service 关闭一个服务:systemctl stop firewalld.service 重启一个服务:systemctl restart firewalld.service 显示一个服务的状态:systemctl status firewalld.service 在开机时启用一个服务:systemctl enable firewalld.service 在开机时禁用一个服务:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep enabled 查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看所有打开的端口: firewall-cmd --zone=public --list-ports 更新防火墙规则: firewall-cmd --reload 查看区域信息: firewall-cmd --get-active-zones 查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0 拒绝所有包:firewall-cmd --panic-on 取消拒绝状态: firewall-cmd --panic-off 查看是否拒绝: firewall-cmd --query-panic

那怎么开启一个端口呢 添加 firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效) 重新载入 firewall-cmd --reload 查看 firewall-cmd --zone=public --query-port=80/tcp 删除 firewall-cmd --zone=public --remove-port=80/tcp --permanent

系统代理

配置/etc/profile

执行vi /etc/profile,添加如下三句: 端口为privoxy配置的端口

export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118

使立即更新

source /etc/profile

开机启动

不要通过rc.local脚本来开机启动,因为会导致死机,centos 7改用服务了 比如nginx。service

nginx.service

[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop

[Install]
WantedBy=multi-user.target

保存目录 以754的权限保存在目录:

/usr/lib/systemd/system/ 3.设置开机自启动 任意目录下执行

systemctl enable nginx.service 4.其他命令 启动nginx服务 systemctl start nginx.service

设置开机自启动 systemctl enable nginx.service

停止开机自启动 systemctl disable nginx.service

查看服务当前状态 systemctl status nginx.service

重新启动服务 systemctl restart nginx.service

查看所有已启动的服务 systemctl list-units --type=service

yum upgrade和yum update的区别

生产环境对软件版本和内核版本要求非常精确,别没事有事随便的进行yum update操作!!!!!!!!!

yum update:升级所有包同时也升级软件和系统内核

yum upgrade:只升级所有包,不升级软件和系统内核

单用户模式 安全摸索

https://blog.csdn.net/saga_gallon/article/details/82877379

cisen commented 2 years ago

物理安装

https://blog.csdn.net/li1121567428/article/details/86547660?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link

解决方法: 在install页面,按e键, 修改 inst.stage2=hd:LABEL=CentOS\x207\x20x86_64.check 为 dd 然后按Ctrl+x. 重启之后会进入到 "dracut:/#" 界面 dracut:/# ls /dev/sdb1 //查看自己USB对于的分区盘符(已实际看到的为准) dracut:/# reboot 在install页面,按e键, 修改inst.stage2=hd:LABEL=CentOS\x207\x20x86_64.check quiet 为 inst.stage2=hd:/dev/sdb1 然后按Ctrl+x.

centos8不能复制黏贴 我们可以选择自己喜欢的桌面环境,在这里选择安装Xfce桌面:

[root@localhost ~]# yum -y install epel-release && yum groupinstall Xfce

安装Xrdp

[root@localhost ~]# yum -y install xrdp

安装完成之后,设置开机启动并启动xrdp

[root@localhost ~]# systemctl start xrdp && systemctl enable xrdp

创建~/.Xclients,设置默认启动xfce4桌面

[root@localhost ~]# echo "xfce4-session" > ~/.Xclients
[root@localhost ~]# chmod +x .Xclients