云盘算 (连续更新中)

打印 上一主题 下一主题

主题 998|帖子 998|积分 2994

PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=27.5 ms
  1. * 关闭防火墙
复制代码
[root@localhost ~]# systemctl stop firewalld
  1. * 确认防火墙关闭情况
复制代码
ystemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since 二 2024-03-26 21:00:13 CST; 2min 18s ago
Docs: man:firewalld(1)
Process: 705 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 705 (code=exited, status=0/SUCCESS)
3月 26 19:44:55 localhost.localdomain systemd[1]: …
3月 26 19:44:56 localhost.localdomain systemd[1]: …
3月 26 19:44:57 localhost.localdomain firewalld[705]: …
3月 26 21:00:12 localhost.localdomain systemd[1]: …
3月 26 21:00:13 localhost.localdomain systemd[1]: …
Hint: Some lines were ellipsized, use -l to show in full.
  1. * 开启防火墙
复制代码
systemctl start firewalld
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 二 2024-03-26 21:04:38 CST; 1min 7s ago
Docs: man:firewalld(1)
Main PID: 9130 (firewalld)
CGroup: /system.slice/firewalld.service
└─9130 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
3月 26 21:04:38 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewal…
3月 26 21:04:38 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall…n.
3月 26 21:04:38 localhost.localdomain firewalld[9130]: WARNING: AllowZoneDrifting is en…
Hint: Some lines were ellipsized, use -l to show in full.
  1. * 取消防火墙开机自动启动设置
复制代码
[root@localhost ~]# systemctl disable firewalld
  1. * 临时关闭防火墙
复制代码
[root@localhost ~]# setenforce 0
[root@localhost ~]# setenforce 1
  1. * 永久关闭防火墙
  2. * ```
  3. [root@localhost ~]# vi /etc/selinux/config
  4. bled
  5. # This file controls the state of SELinux on the system.
  6. # SELINUX= can take one of these three values:
  7. #     enforcing - SELinux security policy is enforced.
  8. #     permissive - SELinux prints warnings instead of enforcing.
  9. #     disabled - No SELinux policy is loaded.
  10. SELINUX=enforcing
  11. # SELINUXTYPE= can take one of three values:
  12. #     targeted - Targeted processes are protected,
  13. #     minimum - Modification of targeted policy. Only selected processes are protected.
  14. #     mls - Multi Level Security protection.
  15. SELINUXTYPE=targeted
  16. ~                                                                                          
  17. ~                                                                                          
  18. ~                                                                                          
  19. ~                                                                                          
  20. :wq
复制代码


  • 检察状态
  1. [root@localhost ~]# getenforce
复制代码
4.快照



  • 在假造服务器中进行对应时间的快照操作

如果出现标题,可以通过规复前面的快照,规复快照时的指令

5.路径-目录的创建



  • Ls 检察当前路径
  • Ls /中国 检察路径下中国文件
  • CD切换目录
  • Cd … 返回上一级目录
  • Cd . 当前目录
  • Cd …/…/./点点数量返回次数,好比在西安,通过此返回到西安。
  • Cd -返回上一次进入的目录
  • CD /中国 切换到中国的路径
  • Pwd 检察当前所在目录(检察
    绝对路径



    ,即/中国/陕西)
  • Mkdir 创建目录
  • Mkdir /a 在根下创建的目录
  • Mkdir a 在所在目中创建的一个小小根
  • Mkdir -p 直接在用户名下指定根下创建目录

    • Mkdir -p /01/01/{01,02}

  • Mkdir-v检察创建过程
  • Yum install tree 安装tree
  1. [root@localhost /]# ls
  2. 01   boot  etc   lib    media  proc  run   srv  tmp  var       学习
  3. bin  dev   home  lib64  mnt    root  sbin  sys  usr  zhongguo  中国
  4. [root@localhost /]#
  5. [root@localhost /]# mkdir -p /opt/a/b/c
  6. [root@localhost /]# tree /opt
  7. /opt
  8. └── a
  9.     └── b
  10.         └── c
  11. 3 directories, 0 files
复制代码
touch 创建文本


    1. [/code]
    2. [/list] [root@localhost home]# touch /opt/file.txt
    3. [root@localhost home]# tree /opt
    4. /opt
    5. ├── a
    6. └── file.txt
    7. 1 directory, 1 file
    8. [code]
    9. 查找小知识:当yum关闭,执行rm -f /var/run/yum.pid后正常进行yum安装的内容
    10. 终端连接到服务器重要使用IP进行连接,使用的是ssh进行协议连接,ssh root @192.168.42.125(端口号22位)
    11. ### 6.文件拷备
    12. 拷贝主要使用命令词cp
    复制代码
    [root@localhost /]# cp -r /opt/a /tmp
    [root@localhost /]# cd /tmp
    [root@localhost tmp]# ls
    a
    ks-script-6_CVQf
    systemd-private-21884cc5cf934fa897803901bc0c5010-chronyd.service-9VXlBi
    systemd-private-278a64b471014c7c9e06255891e9db60-chronyd.service-V6LscI
    systemd-private-4ba49a680b2143acad4b4f22972a738d-chronyd.service-cpie7T
    systemd-private-7700d0306cf04fa7974aded2a5b4163b-chronyd.service-hqtM4M
    systemd-private-7d007bbf789a46f98aae0f9ce4b79c59-chronyd.service-EpYhNT
    systemd-private-90d6be988e1a4f04a156c442b76d1669-chronyd.service-Mo5Xuj
    systemd-private-a03007a2665542b192b481f04ec40f07-chronyd.service-0fQMtS
    systemd-private-d2783f5906cf4b6ba77272eed962d29f-chronyd.service-xaDnqE
    systemd-private-f86f9439466540fe8135d13c42f5605b-chronyd.service-VB5RIR
    yum.log
    1. >
    2. > 扩展:在复制中,可以对复制的内容进行重命名 (cp -r /otp/a /tmp/a-1)
    3. >
    4. >
    5. >
    6. ### 7.文件移动
    7. 拷贝主要使用命令词mv
    复制代码
    [root@localhost opt]# cd /home
    [root@localhost home]# ls
    etc ifcfg-ens33 passwd tt yun
    1. ### 8.文件删除
    2. 拷贝主要使用命令词rm
    复制代码
    [root@localhost c]# rm -rf /opt/a/b
    [root@localhost opt]# tree /opt/a
    /opt/a
    0 directories, 0 files
    [root@localhost opt]# tree /opt
    /opt
    └── a
    1 directory, 0 files
    1. ### 9.
    2. 绝对路径
    3. 与相对路径
    4. 相对路径
    复制代码
    [root@localhost tmp]# cd
    [root@localhost ~]# cd /
    [root@localhost /]# cd opt
    [root@localhost opt]# cd a
    [root@localhost a]# cd b
    [root@localhost b]# cd c
    [root@localhost c]# cd …
    [root@localhost b]# cd …/…/…
    [root@localhost /]# cd otp
    -bash: cd: otp: 没有那个文件或目录
    [root@localhost /]# cd opt
    [root@localhost opt]# tree
    .
    └── a
    └── b
    └── c
    3 directories, 0 files
    1. 绝对路径
    复制代码
    ​[root@localhost ~]# cd /opt/a/b/c
    [root@localhost c]#

    1. ### 10.查看各个指定路径下的文件
    2. 使用代码 tree
    复制代码
    [root@localhost home]# tree /etc/sysconfig
    /etc/sysconfig
    ├── anaconda
    ├── authconfig
    ├── cbq
    │   ├── avpkt
    │   └── cbq-0000.example
    ├── chronyd
    ├── console
    ├── cpupower
    ├── crond
    ├── ebtables-config
    ├── firewalld
    ├── grub -> …/default/grub
    ├── init
    ├── ip6tables-config
    ├── iptables-config
    ├── irqbalance
    ├── kdump
    ├── kernel
    ├── man-db
    ├── modules
    ├── netconsole
    ├── network
    ├── network-scripts
    │   ├── ifcfg-lo
    │   ├── ifdown -> …/…/…/usr/sbin/ifdown
    │   ├── ifdown-bnep
    │   ├── ifdown-eth
    │   ├── ifdown-ippp
    │   ├── ifdown-ipv6
    │   ├── ifdown-isdn -> ifdown-ippp
    │   ├── ifdown-post
    │   ├── ifdown-ppp
    │   ├── ifdown-routes
    │   ├── ifdown-sit
    │   ├── ifdown-Team
    │   ├── ifdown-TeamPort
    │   ├── ifdown-tunnel
    │   ├── ifup -> …/…/…/usr/sbin/ifup
    │   ├── ifup-aliases
    │   ├── ifup-bnep
    │   ├── ifup-eth
    │   ├── ifup-ippp
    │   ├── ifup-ipv6
    │   ├── ifup-isdn -> ifup-ippp
    │   ├── ifup-plip
    │   ├── ifup-plusb
    │   ├── ifup-post
    │   ├── ifup-ppp
    │   ├── ifup-routes
    │   ├── ifup-sit
    │   ├── ifup-Team
    │   ├── ifup-TeamPort
    │   ├── ifup-tunnel
    │   ├── ifup-wireless
    │   ├── init.ipv6-global
    │   ├── network-functions
    │   └── network-functions-ipv6
    ├── ntpdate
    ├── rdisc
    ├── readonly-root
    ├── rsyslog
    ├── run-parts
    ├── selinux -> …/selinux/config
    ├── sshd
    └── wpa_supplicant
    4 directories, 61 files
    1. ## 二、指令汇总
    2. 1. IP
    3.         1. Ip a (查询ip的详情,如果不显示可以使用ipup ens33显示ip地址)
    4.         2. IP自启
    5. 1. 查看时间 date
    6.         1. Date命令查看时间
    7.         2. Date -r 修改系统时间
    8.         3. Hwdate -r 修改硬件时间
    9.         4. Ntpdate {systohc hctosys}同步时间,如果插件未安装,需要使用yum install进行安装,然后同步时间--ntpdate ntp.aliyun.com 同步阿里云时间
    10.         5. 将硬件时间写入到主办中 hwclock -w
    11.         6. 硬盘时间同步系统 hwclick --hctosys
    12.         7. 系统时间同步硬盘 hwclock --systihc
    13. 2. 查看防火墙
    14.         1. 检查防火墙状态:systemctl status firewalld
    15.         2. 关闭防火墙:systemctl stop firewalld
    16.         3. 关闭防火墙自启:systemctl disable firewalld
    17.         4. 重启系统:reboot
    18. 3. 关闭selinux
    19.         1. 查看状态:getenforce
    20.         2. 关闭:vi /etc/selinux/config  中将SELINUX=disabled
    21.         3. 临时关闭: setenforce 0
    22.         4. 重启系统:reboot
    23. 4. 查看目录类操作
    24.         1. 查看指定路径:cd
    25.         2. 查看路径下的目录:ls
    26.         3. 查看路径下文件的详情:ls -l
    27.         4. 查看文件中的所有文件包括隐藏文件 :ls -a
    28.         5. 查看路径下文件详情且文件大小转码:ls-lh
    29.         6. 查看当前位置:pwd
    30.         7. 创建目录:mkdir
    31.         8. 创建文件:touch
    32.         9. 查看目录下的文件且以树状展示:tree  tree -l 数字表示展示几级目录
    33.         10. 拷贝文件 cp
    34.         11. 拷贝目录:cp -r
    35.         12. 移动文件:mv
    36.         13. 移动目录:mv-r
    37.         14. 删除文件:rm
    38.         15. 删除目录:rm -r
    39.         16. 强制删除: rm -rf
    40.         17. 查看文件详情:cat
    41.         18. 查看文件详情且展示行号:cat -n
    42.         19. 查看文件的结尾符号:cat-A
    43.         20. 查看文件的开头和结尾:heed tail
    44.         21. 指定行号: head - 数字 |tail -数字
    45.         22. 上传:rz
    46.         23. 下载:sz
    47. 5. Yum的配置
    48.         1. 先保存现有机器上的yum ,现有yum在
    49.         2. 下载curl -o /etc/yum.repos.d/CentOS-Base.repo [https://mirrors.aliyun.com/repo/Centos-7.repo]( )
    50. curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
    51. 1. 1. 清理yum缓存:yum clean all
    52.         2. 加载yum:yum makecache
    53.         3. 显示yum: yum repolist
    54. 2. 远程登录
    55.         1. Ssh [root@192.168.42.131](mailto:root@192.168.42.131)
    56.         2. 远程拷贝 :scp 目录路径 root@192.168.42.131:保存路径
    57.         3. 远程查看复制内容是否成功:ssh [root@192.168.42.131](mailto:root@192.168.42.131) “ls 路径
    58.         4. 端口更改后远程登录:ssh -p root@192.168.42.131
    59. 3. 创建单用户
    60.         * + vi /etc/grub.d/10\_linux
    61.                 + 将复制到文档最后,其中new为用户名,将两个new都要给为新的用户名
    62. cat <<EOF
    63. set superusers="new"
    64. password new 123456
    65. EOF
    66. 1. * + 生成新的grub文件:grub2-mkconfig --output=/boot/grub2/grub.cfg
    67.         * 查看本服务器的内核:uname -r
    68.         * 终端对话:write root pts/0
    69. 2. 给其他IP重名
    70.         * + Vi /etc/hosts  在文档中的第三行开始进行编写,ip空格自定义的名称。
    71. 3. 编写文档
    72.         * + 一个井号为一级标题
    73. 两个井号为二级标题
    74. 快捷键为Ctrl+数字
    75. * + - 代码块
    76. 三个上撇,多行代码块
    77. 单行代码`stemectl`,用一个上撇
    78. * + - 字体换颜色,只能给标题和正文添加
    79. <font colir=red> 文本 </font>
    80. 1. 打包、压缩(打包后文件大小不变,)  -f 文件;-v列出过程;-c创建包;-x归档中解析;-z使用gzip的格式进行压缩。
    81.         * + 解压zip压缩包,使用unzip进行解压。
    82.                 + 进行打包:tar cvf    tar cvf 打包后的名称.tar 压缩前的目录
    83. Tar cvf root.tar root/
    84. * + - 解压 tar xvf 解压的文件。
    85.                 - 压缩并打包:tar czvf  tar czvf  root.tar.gz  root/
    86.                 - 解包&解压缩:tar xzvf  文件名称
    87.                 - 解压到对应的位置 :tar xzvf 文件名称 -C路径
    88.                 - Dd if=/dev/zero of=/xa2402.txt bs=1024M count=5 查看磁盘写的速率,创建一个文件并指定大小。文件大小等于 bs\*count
    89.                 - Gzip 压缩文件,但是源文件被删除,只压缩文件
    90.                 - Gzip -d 进行解压
    91. 1. 1. Ll-h 查看文件的大小。
    92.         2. Du -sh 文件名 查看指定目录的空间大小,不包含快捷内容(工作中可以使用此命令看磁盘大小,进行相应的清理)
    93.                 * Du -sh \*
    94. 2. 免密登录
    95.         1. 创建秘钥对:Ssh-keygen       生成秘钥对的地址 id\_rse 私钥
    96.         2. 秘钥在:/root/.ssh  生成 rse(私钥) pub(公钥)
    97.         3. Ssh-copy-id  传递公钥
    98.         4. Koown 我登录过的   authouized 远程登录过的账号
    99.         5. echo >清空文件
    100. 10.36.178.100 -2017  131  0
    101. 181.128   333
    102. 1. 远程登录
    103. * 远程登录后,更改文件sshd\_config中信息 /etc/ssh/sshd\_config
    104. * 远程登录更改欢迎词
    105.         1. 登录词:远程登录后,在etc/ssh/sshd\_config中将banner中贴入Banner /etc/ssh/banner;编辑/etc/ssh/banner 中的信息,然后保存
    106.         2. 输入密码后:更改/etc/ssh/banner 中的信息,保存
    107.         3. 更新ssh ,systemctl instart sshd
    108. ## 三、作业
    109. ### 3.27
    复制代码
    免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

忿忿的泥巴坨

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表