Linux常用工具包安装

Linux入门教程

使用环境 VMware Workstation CentOS7 Xshell 5
一个新人的学习心得,请各个大佬多多指点



Linux工具包安装

半自动完成Linux工具包的安装

通过安装Linux的各种工具包可以帮助我们更方便的使用Linux,本章就将提供一个无脑的安装方法,只要按照流程就可以解决,足够满足正常的学习和使用。


1. 提供的工具包

本方法提供的工具包共包括下列工具:

工具包作用
tree显示目录的树形结构
nmap主机发现和端口扫描工具
lrzsz文件传输工具
dos2unixDos格式文件转换为Unix格式文件
ncnetcat 安全工具,可实现端口侦听、端口扫描、传输文件、网络测速
lsoflist open files 查看打开的文件 系统监测工具
wget文件下载工具 从网络上自动下载文件的自由工具
tcpdump抓包工具 可监听网卡、指定协议的数据、指定主机、指定端口、除某个端口之外的其它端口。
htop监控软件
iftop实时流量监控工具 可用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等
iotop监视磁盘I/O使用状况的top类工具
sysstat观察服务负载 如CPU和内存的占用率、网络的使用率、磁盘写入和读取速度等
nethogs网络流量监控工具
psmisc实用性命令工具 pstree-以树状图显示程序;killall-用于杀死指定名字的进程;fuser-用来显示所有正在使用着指定的file/file system或sockets的进程信息。
net-tool工具箱
bash-completion命令自动补全工具
MariadbMariaDB数据库管理系统 mariadb-5.5.68-1.el7.x86_64
Nginxweb服务器 nginx-1.20.2-1.el7.ngx.x86_64
Iptables防火墙 iptables-1.4.21-35.el7.x86_64

2、使用方法

首先就是获取脚本了,通过百度云获取,只有两个小文件,不大。
一份使用说明和一份脚本文件
链接:https://pan.baidu.com/s/1Ln81JrSdwD7Nl-aY7nU9uQ?pwd=1111
提取码:1111

注意:第3条命令选择颜色如果不满意,再次执行这条命令就行;输入序号错误时可以按“Ctrl+Backspace”删除后重新输入;脚本的每条命令均可单独执行,但初次装机请按顺序执行
使用方法

  1. 依次复制下面三条命令到Xshall页面,等待完成即可,注意全程需要联网
curl -s -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -s -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum install lrzsz -y 			# 安装文件传输工具,方便下一步
  1. 然后将tools_install.sh文件拖至Xshell界面。完成上述命令后执行下面的命令
source tools_install.sh
  1. 按照顺序依次输入对应序号回车即可,Mariadb数据库/Nginx/Iptables可视情况自行决定是否安装,如不需要可以不安装
  2. 全部执行完成后输入 7 即可退出脚本

3.源码

代码如下:

#!/bin/bash
##############################################################
# File Name: tools_install.sh
# Version: V1.0
# Author: zero
# Organization:
# Created Time : 2022-04-15 17:39:39
# Description:net sec 11
##############################################################
while [ true ]
do
cat <<end
=============================
菜单:
1.配置官方源
2.基础工具包
3.命令行色彩配置(用户绿色 主机名黄色)
4.Mariadb安装
5.Nginx安装
6.Iptables安装
7.退出
=============================
end
    read -p "请选择项目:" opt
## 配置官方源
    if [ $opt == 1 ]
    then
        curl -s -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
        curl -s -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
    fi

## 基础工具包安装
    if [ $opt == 2 ]
    then
        yum install tree nmap dos2unix lrzsz nc lsof wget -y
        yum install tcpdump htop iftop iotop sysstat nethogs -y
        yum install psmisc net-tools bash-completion vim-enhanced -y
    fi
## 命令行色彩配置
    if [ $opt == 3 ]
    then
        cat <<end
================================
字体颜色对应序号:
30--黑色    31--红色    32--绿色
33--黄色    34--蓝色    35--紫红
36--青蓝    37--白色
================================
end
        read -p "请选择中括号颜色:" kh
        read -p "请选择用户名颜色:" yh
        read -p "请选择主机名颜色:" zj
        read -p "请选择目录名颜色:" ml
        read -p "请选择提示符颜色:" ts
        echo "PS1='\[\e[$kh;1m\][\[\e[0m\]\[\e[$yh;1m\]\u@\[\e[0m\]\[\e[$zj;1m\]\h\[\e[0m\]\[\e[$ml;1m\] \W\[\e[0m\]\[\e[$kh;1m\]]\[\e[0m\]\[\e[$ts;1m\]\\$ \[\e[0m\]'" >>/etc/profile
        source /etc/profile
        
    fi
## Mariadb安装
    if [ $opt == 4 ]
    then
        yum install mariadb-server mariadb -y
        systemctl start mariadb
        systemctl enable mariadb
    fi
## Nginx安装
    if [ $opt == 5 ]
    then
        setenforce 0        ## 临时关闭selinux
        sed -i 's#SELINUX=enforcing#SELINUX=disabled#g'      ## 永久关闭selinux
        systemctl stop firewalld        ## 关闭防火墙
        systemctl disable firewalld     ## 关闭防火墙开机自启
        yum install yum-plugin-priorities -y        ## 安装插件,设置yum在调用软件时的顺序
        cat >/etc/yum.repos.d/nginx.repo<<'EOF'
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
priority=1
EOF
        rpm -e nginx
        yum install nginx -y
        systemctl start nginx
        fi
## Iptables安装
        if [ $opt == 6 ]
        then
            yum install iptables iptables-services -y
            systemctl start iptables
            systemctl enable iptables
        fi
## 退出
        if [ $opt == 7 ]
        then
            echo -e "\e[1;31m 退出 \e[0m"
        exit
        fi
        
done


  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值