Linux基础优化与常用软件包说明

1.安装常用工具

1.1CentOS(7)

1.1.1 是否联网
复制代码
ping qq.com
1.1.2 配置yum源(安装软件的软件仓库)

默认情况下yum下载软件的时候是从随机地址下载。
配置yum从国内下载(仅执行即可),修改yum配置指定统一下载地址(阿里云).

修改yum下载软件的地址,改为阿里云

复制代码
#配置yum源
##备份yum源配置
cp  /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.bak

##下载yum的配置并更新本地的yum配置 命令 1 CentOS-Base.repo
#/etc/yum.repos.d/CentOS-Base.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

#/etc/yum.repos.d/epel.repo
##下载yum的配置并更新本地的yum配置 命令 2 epel.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

##检查是否下载成功
ll -rt /etc/yum.repos.d/
1.1.3 安装常用软件:vim,telnet,tree,sl(娱乐),cowsay(娱乐)
复制代码
#安装Linux常用工具
yum install -y    tree   vim wget  bash-completion  bash-completion-extras  lrzsz  net-tools sysstat  iotop iftop htop unzip nc nmap telnet bc  psmisc httpd-tools  bind-utils nethogs expect

#Linux娱乐命令
yum install  -y sl  cowsay 

#检查 运行命令不提示命令找不到即可.
运行tree命令
运行sl命令。
运行animalsay命令
软件包 说明
tree 以树形显示目录
telnet 测试端口
vim 进阶编辑器
bash-completion 默认自动补全工具包
bash-completion-extras 自动补全增强版,重新登录
unzip 解压zip格式压缩包
lrzsz rz命令和sz命令
net-tools ifconfig命令 netstat命令
expect mkpasswd命令
psmisc pstree,killall命令
htop htop命令,top命令升级版

● 故障排查流程:

○ 检查是否下载了aliyun配置文件

○ 执行yum安装命令

软件安装完成后并检查后拍摄快照。

● 如何知晓已经安装成功?

● 检查是否有"完成"提示 "Complete"

1.2Kylin(v10 sp3)

1.2.1 是否联网
复制代码
ping qq.com
1.2.2 配置yum源并安装常用工具

yum 红帽类系统安装软件的命令.

● 给麒麟增加一个软件下载地址(epel centos7地址)

在这里找:https://developer.aliyun.com/mirror/

复制代码
#1.下载额外的软件源
yum install -y wget
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

#安装Linux常用工具
yum install -y    tree telnet  vim wget  bash-completion    lrzsz  net-tools sysstat  iotop iftop htop unzip nc nmap telnet bc  psmisc httpd-tools  bind-utils nethogs expect

#检查 运行命令不提示命令找不到即可.
运行tree命令
运行telnet 10.0.0.200 22 

这里会有些提示
未找到匹配的参数: iftop #先略过即可.


#麒麟中有趣命令
yum install -y  sl  cowsay  aalib

sl命令
cowsay命令
animalsay命令
aafire命令
软件包 说明
tree 以树形显示目录
telnet 测试端口
vim 进阶编辑器
bash-completion 默认自动补全工具包
unzip 解压zip格式压缩包
lrzsz rz命令和sz命令
net-tools ifconfig命令 netstat命令
expect mkpasswd命令
psmisc pstree,killall命令
htop htop命令,top命令升级版

1.3Ubuntu(22.04)

Ubt和debian系统中安装软件用的是apt命令.

1.3.1 配置apt下载地址

清华大学ubt的apt源地址: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

复制代码
#0.切换root用户
sudo su -

#1.备份/etc/apt/sources.list文件 到/tmp/
cp /etc/apt/sources.list  /tmp/

#2.vim编辑/etc/apt/sources.list 文件
dG #vi/vim快捷键 删除当前行到最后一行的内容.


# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse



#3.执行apt update 生成本地软件包缓存,如果不执行则下载软件失败.
apt update 

#4.安装软件
apt install -y tree  telnet  vim   lrzsz   wget    unzip 

#5.趣味软件
apt install -y cmatrix lolcat  nyancat screenfetch  libaa-bin

nyancat 彩虹猫
lolcat
cmatrix
screenfetch 信息展示
aafire 

2.配置命令行颜色(修改命令提示符)

2.1 麒麟、红帽

复制代码
#配置
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.重新登录后检查颜色

3openssh服务配置

复制代码
openssh就是远程服务. 服务名字叫sshd
1. 修改远程连接端口
2. ubt系统root,禁止root远程登录

● 配置文件:/etc/ssh/sshd_config

sshd_config的内容
Port 22 修改ssh端口号,端口范围1-65535 推荐10000以上 52113
#PermitRootLogin prohibit-password 右边是非yes,禁止root远程登录,ubt默认禁止root远程登录
复制代码
#1.修改sshd配置文件
vim  /etc/ssh/sshd_config
找到#PermitRootLogin 去掉注释,
修改为
PermitRootLogin yes

#2.保存退出后重启服务
systemctl restart sshd 

#3.给root设置密码
passwd   

#4重新用户root远程登录即可

麒麟系统修改端口号后,需要关闭防火墙

复制代码
#红帽类系统
systemctl disable   --now   firewalld

#ubt
systemctl disable   --now   ufw
相关推荐
A小辣椒1 天前
TShark:Wireshark CLI 功能
linux
A小辣椒1 天前
TShark:基础知识
linux
AlfredZhao1 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao2 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334662 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪2 天前
linux 拷贝文件或目录到指定的位置
linux
摇滚侠3 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
bush43 天前
嵌入式linux学习记录十四、术语
linux·嵌入式
载数而行5203 天前
Linux 11 动态监控指令top
linux
不会C语言的男孩3 天前
Linux 系统编程 · 第 8 章:进程基础
linux·c语言