基础 -- Linux(四)软件的安装与管理

上一篇讲了文件和权限,这一篇主要讲软件的安装与管理

软件管理


APT使用它可以找到想要的软件包, 而且安装、卸载、更新都很简便。也可以用来对 Ubuntu 进行升级; APT 的源文件为 /etc/apt/ 目录下的 sources.list 文件。

首先需要查看系统版本lsb_release -a,获取代号Codename

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic # 代号

ubuntu 16.04 LTS版本的是xenial

修改数据源,vi /etc/apt/sources.list,因为我们在装系统的时候已经制定了镜像所以得到的是以下片段。
在这里插入图片描述
如果装系统当时没有指定需要修改成阿里云的镜像

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

保存后更新数据源apt-get update

安装软件包:apt-get install

删除软件包:apt-get remove

比如我们安装htop

# 安装htop
apt-get install htop

Reading package lists... Done
Building dependency tree       
Reading state information... Done
htop is already the newest version (2.1.0-3).
htop set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.

输入htop
在这里插入图片描述

# 删除htop
apt-get remove htop

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  htop ubuntu-server
0 upgraded, 0 newly installed, 2 to remove and 53 not upgraded.
After this operation, 269 kB disk space will be freed.
Do you want to continue? [Y/n] 
# 是否删除 y/n
y

(Reading database ... 66944 files and directories currently installed.)
Removing ubuntu-server (1.417.3) ...
Removing htop (2.1.0-3) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

那平时的javatomcatmysql也都是这么安装的吗?并不是现在分为2中方法一种是用容器,还有一种是用ftp上传到服务器上来进行安装,这些以后再讲解。

## 查看占用端口的软件
netstat -nlp | grep :80
## 输出
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      15839/java      
## 关闭
kill -9 [pid] 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值