上一篇讲了文件和权限,这一篇主要讲软件的安装与管理
软件管理
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) ...
那平时的java
,tomcat
,mysql
也都是这么安装的吗?并不是现在分为2中方法一种是用容器,还有一种是用ftp
上传到服务器上来进行安装,这些以后再讲解。
## 查看占用端口的软件
netstat -nlp | grep :80
## 输出
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 15839/java
## 关闭
kill -9 [pid]