当前位置: 首页> 房产> 市场 > 南京网站建设公司大全_怎么制作图片加音乐_平面设计培训班学费一般多少_淘宝关键词

南京网站建设公司大全_怎么制作图片加音乐_平面设计培训班学费一般多少_淘宝关键词

时间:2025/7/12 16:04:09来源:https://blog.csdn.net/qq_52174380/article/details/147568011 浏览次数:0次
南京网站建设公司大全_怎么制作图片加音乐_平面设计培训班学费一般多少_淘宝关键词

文章目录

  • 1. 配置下载源
    • 1.1 Kylin
    • 1.2 Ubuntu 22.04
      • 1.2.1 清华源
      • 1.2.2 阿里云源
      • 1.2.3 更新下载源地址
  • 2. 更改命令行颜色
    • 2.1 Kylin
    • 2.2 Ubuntu
  • 3. 关闭防火墙
  • 4. OpenSSH服务配置
    • 4.1 修改ssh端口和允许root远程登录
      • 4.1.1 Kylin
      • 4.1.2 Ubuntu 22.04
  • 5. ss命令
  • 6. 踩坑记录
    • 6.1 Ubuntu自动更新,导致无法输入命令
    • 6.2 更新apt源时报错:403 forbidden 连接拒绝
    • 6.3 permission denied权限拒绝
    • 6.4 apt install 的时候提示 unable to locate package 无法定位软件包(查找软件包)
    • 6. 5 【重点】Ubuntu网卡配置
    • 6.6 vim快捷键:删除所有行
    • 6.7 查看系统信息
  • 7. 思维导图

1. 配置下载源

  • 保证虚拟机能正常联网
  1. ping DNS服务器(223.5.5.5)
  2. ping 网关(10.0.0.2)
  3. 查看vmware的网络编辑器
  4. 查看主机是否能上网

1.1 Kylin

  • yum源网址:[epel镜像_epel下载地址_epel安装教程-阿里巴巴开源镜像站](https://developer.aliyun.com/mirror/epel?spm=a2c6h.13651102.0.0.17bf1b11A77dVP)

    在这里插入图片描述

  • yum的下载源文件位置:/etc/yum.repos.d/epel.repo

# 配置yum源
yum install -y wget
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
[root@oldboy99 /etc/yum.repos.d]# ls
epel.repo  kylin_x86_64.repo

1.2 Ubuntu 22.04

  • 在root用户下操作
  • Ubuntu中软件管理工具是apt
  • apt的下载源配置文件路径是 /etc/apt/sources.list
  • 以下下载源只适用于Ubuntu 22.04

1.2.1 清华源

  • 网址:[ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror](https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/)
  • 在这里插入图片描述

1.2.2 阿里云源

  • 网址:[ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站](https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.17bf1b11ZPXCkt)

  • 选择适合的版本

    在这里插入图片描述

1.2.3 更新下载源地址

apt update
# 更新apt源之后要及时执行该命令

在这里插入图片描述

2. 更改命令行颜色

2.1 Kylin

#配置
echo "export PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\]\[\e[31;1m\] \w\[\e[0m\]]\\$ '" >>/etc/profile
#生效
source /etc/profile#把配置命令行的命令追加到/etc/profile中.
#重新连接Linux就生效.
#也可以通过查看/etc/profile文件内容进行检查cat /etc/profile看最后一行

2.2 Ubuntu

#1.切换到root 
sudo su -#2.执行指令(针对用户的)
echo "export PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\]\[\e[31;1m\] \w\[\e[0m\]]\\$ '" >>~/.bashrc#3.重新登录后检查颜色

3. 关闭防火墙

防火墙说明
firewalld红帽系统;默认开启;
ufwUbuntu防火墙
selinux美国国家安全局设置,增强了Linux系统的安全性,各种Linux系统一般都有。Kylin中关闭了,Ubuntu中没有安装。
# Kylin 
# 暂时关闭防火墙,重启系统后防火墙还会运行
[root@oldboy99 ~]# systemctl stop sshd.service 
# 禁用防火墙,今后不会运行
[root@oldboy99 ~]# systemctl disable sshd.service 
Removed /etc/systemd/system/multi-user.target.wants/sshd.service.
# 不用关闭,直接禁用防火墙
[root@oldboy99 ~]# systemctl disable sshd.service --now 
# 查看防火墙状态
[root@oldboy99 ~]# systemctl status sshd.service 
● sshd.service - OpenSSH server daemonLoaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:sshd(8)man:sshd_config(5)427 19:05:36 oldboy99 sshd[6058]: Connection from 10.0.0.1 port 4674 on 10.0.0.203 port 12345 rdomain ""
427 19:05:36 oldboy99 sshd[6058]: reprocess config line 147: Deprecated option RSAAuthentication
427 19:05:36 oldboy99 sshd[6058]: reprocess config line 149: Deprecated option RhostsRSAAuthentication
427 19:05:36 oldboy99 sshd[6058]: Accepted password for root from 10.0.0.1 port 4674 ssh2
427 19:05:36 oldboy99 sshd[6058]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
427 19:05:36 oldboy99 sshd[6058]: User child is on pid 6070
427 19:06:18 oldboy99 sshd[4591]: Received signal 15; terminating.
427 19:06:18 oldboy99 systemd[1]: Stopping OpenSSH server daemon...
427 19:06:18 oldboy99 systemd[1]: sshd.service: Succeeded.
427 19:06:18 oldboy99 systemd[1]: Stopped OpenSSH server daemon.

# Ubuntu 22.04
# Ubuntu关闭防火墙命令与Kylin基本相同,注意防火墙的进程是ufw
# 禁用防火墙
[root@oldboy99-ubantu ~]# systemctl disable --now ufw
Synchronizing state of ufw.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable ufw
# 查看防火墙状态
[root@oldboy99-ubantu ~]# systemctl status ufw.service 
○ ufw.service - Uncomplicated firewallLoaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)Active: inactive (dead)Docs: man:ufw(8)Apr 27 05:31:11 oldboy99-ubantu systemd[1]: Starting Uncomplicated firewall...
Apr 27 05:31:11 oldboy99-ubantu systemd[1]: Finished Uncomplicated firewall.
Apr 27 11:12:29 oldboy99-ubantu systemd[1]: Stopping Uncomplicated firewall...
Apr 27 11:12:29 oldboy99-ubantu ufw-init[4946]: Skip stopping firewall: ufw (not enabled)
Apr 27 11:12:29 oldboy99-ubantu systemd[1]: ufw.service: Deactivated successfully.
Apr 27 11:12:29 oldboy99-ubantu systemd[1]: Stopped Uncomplicated firewall.

4. OpenSSH服务配置

  • 服务端程序是sshd
  • 客户端程序是ssh

4.1 修改ssh端口和允许root远程登录

  • 配置文件:/etc/ssh/sshd_config。注意是sshd_config
参数说明
Port 22ssh端口默认是22,修改后推荐是10000以上
#PermitRootLogin prohibit-password是否允许root用户远程登录。修改成yes
  • 修改文件后要重启ssh服务:systemctl restart sshd
  • ubuntu需要为root用户设置密码

4.1.1 Kylin

[root@oldboy99 ~]# vim /etc/ssh/sshd_config
[root@oldboy99 ~]# cat /etc/ssh/sshd_config
……
# 修改ssh端口为12345
Port 12345
……
# 允许root用户远程登录
PermitRootLogin yes
……
# 重启sshd服务
[root@oldboy99 ~]# systemctl restart sshd.service 
  • 修改后重新连接xshell,修改ssh端口

在这里插入图片描述

4.1.2 Ubuntu 22.04

# Ubuntu的操作与Kylin一样,只是需要为root设置密码,便于以后登录
[root@oldboy99-ubantu ~]# passwd 
New password: 
Retype new password: 
passwd: password updated successfully

5. ss命令

ss:Socket Statistics,监听网络连接和进程信息。下面是常用用法:

[root@oldboy99 ~]# ss -lntup
Netid  State   Recv-Q   Send-Q     Local Address:Port      Peer Address:Port  Process                        
udp    UNCONN  0        0                0.0.0.0:67             0.0.0.0:*      users:(("dhcpd",pid=3163,fd=10))  
udp    UNCONN  0        0              127.0.0.1:323            0.0.0.0:*      users:(("chronyd",pid=739,fd=6))  
udp    UNCONN  0        0                      *:69                   *:*      users:(("systemd",pid=1,fd=65))   
udp    UNCONN  0        0                  [::1]:323               [::]:*      users:(("chronyd",pid=739,fd=7))  
tcp    LISTEN  0        128              0.0.0.0:12345          0.0.0.0:*      users:(("sshd",pid=7044,fd=4))  
tcp    LISTEN  0        128                 [::]:12345             [::]:*      users:(("sshd",pid=7044,fd=5))  
tcp    LISTEN  0        128                    *:80                   *:*      users:(("httpd",pid=3814,fd=4),("httpd",pid=3813,fd=4),("httpd",pid=3812,fd=4),("httpd",pid=3809,fd=4))

6. 踩坑记录

6.1 Ubuntu自动更新,导致无法输入命令

在这里插入图片描述

系统进行自动更新 导致命令无法执行。

解决方法:等待。

6.2 更新apt源时报错:403 forbidden 连接拒绝

在这里插入图片描述

下载源有问题,更换下载地址。

6.3 permission denied权限拒绝

在这里插入图片描述

命令无权限执行,应该使用root用户。

6.4 apt install 的时候提示 unable to locate package 无法定位软件包(查找软件包)

在这里插入图片描述

原因:

  1. 修改apt源配置文件后没有执行apt update
  2. apt源有问题

在这里插入图片描述

  • apt配置文件有问题

6. 5 【重点】Ubuntu网卡配置

# 查看网卡配置信息
[root@oldboy99-ubantu ~]# cat /etc/netplan/00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:ethernets:ens33:addresses:- 10.0.0.201/24nameservers:addresses:- 223.5.5.5- 223.6.6.6search: []routes:- to: defaultvia: 10.0.0.2version: 2
# 将网卡配置文件应用到系统中 
[root@oldboy99-ubantu ~]# netplan  apply 
WARNING:root:Cannot call Open vSwitch: ovsdb-server.service is not running.
# 重新加载网络配置文件
[root@oldboy99-ubantu ~]# networkctl reload 
  • 最后先重新加载网卡配置文件,再重新加载网络配置文件

6.6 vim快捷键:删除所有行

  • 命令模式下,输入dG
  • 该命令会删除所在及其一下的行

6.7 查看系统信息

  • cat /etc/os-realease
# Ubuntu 
[root@oldboy99-ubantu ~]# cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
# Kylin
[root@oldboy99 ~]# cat /etc/os-release 
NAME="Kylin Linux Advanced Server"
VERSION="V10 (Lance)"
ID="kylin"
VERSION_ID="V10"
PRETTY_NAME="Kylin Linux Advanced Server V10 (Lance)"
ANSI_COLOR="0;31"

7. 思维导图

【金山文档】 思维导图 https://www.kdocs.cn/l/co3I7PtpTYQX

关键字:南京网站建设公司大全_怎么制作图片加音乐_平面设计培训班学费一般多少_淘宝关键词

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: