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
相关推荐
Lonely 净土5 小时前
Linux 运维文件写入操作
linux·运维·服务器·文件管理
吠品8 小时前
Wine 在 Linux 上运行 Windows 软件完整指南
java·linux·服务器
深念Y10 小时前
从 Windows 迁移到 Linux 开发环境的记录
linux·windows·链接·bun·ram·imdisk
知无不研11 小时前
Linux I/O复用之epoll
linux·服务器·epoll·socket编程
fb_1234512 小时前
Linux运维封神|SELinux详解+CentOS7启动原理+Root密码重置+开机故障排查实战
linux·运维·服务器
苏宸啊12 小时前
linux网络编程udp服务器和客户端代码编写(echo版本和字典版本)
linux·网络
~|Bernard|12 小时前
Linux 定时任务(Cron)完整教程
linux·运维·服务器
小雪崩13 小时前
嵌入式学习 day25:哈希表及排序与查找
linux·c语言·数据结构·学习·排序算法
深念Y13 小时前
linux桌面快捷方式开关脚本编写中的几个常见坑
linux·运维·服务器·快捷方式·桌面·kde
奇树谦14 小时前
HDD 为什么适合顺序大文件读写:从 RAID 5 到 RAID 50 的原理与性能分析
linux·运维·网络