Linux(ubuntu)安装软件
在Linux安装软件前,首先要了解压缩与解压缩。
压缩与解压缩
- zip / unzip
可以对多个文件和目录进行压缩。
zip 123.zip 1.txt 2.txt 3.txt unzip 123.zip
- gzip / gunzip
只能压缩单个文件,不能压缩目录。
gzip -c 1.txt 1.gz gunzip -c 1.gz > 1.txt ##注意:若不适用 -c ,使用gzip或gunzip对文件进行压缩与解压缩的时候,源文件会被删除。
- bzip2 / bunzip2
同样也只能压缩单个文件,不能压缩目录。
bzip2 -c 1.txt 1.bz2 bunzip2 -c 1.bz2 > 1.txt ##注意:若不适用 -c ,使用gzip或gunzip对文件进行压缩与解压缩的时候,源文件会被删除。
在进行压缩与解压缩时,一定要遵循压缩、解压缩都是相同的方式。
打包
- tar
用于打包与解包文件。 - 选项
-c 打包
-x 解包
-v 显示相关信息
-f 指定操作文件
-t 检查包
–exclude 排除指定文件
-z 调用gzip/gunzip
-j 调用bzip2/bunzip2
-C 指定解压位置
tar -cvf 123.tar *.txt #打包 tar -xvf 123.tar #解包 tar -zcvf 123.tar.gz *.txt --exclude 3.txt #打包并压缩,但除了3.txt文件 tar -zxvf 123.tar.gz #解包并解压缩
安装软件
- 使用专门的命令安装,无需考虑包的依赖关系
- 选项
install 安装软件包 remove 删除软件包 update 更新软件包 upgrade 进行一次系统的更新
- 命令:sudo apt-get install openssh-server
使用:- sudo service sshd start|stop
- sudo ssh 用户名@IP地址
- 使用特定的安装包的命令安装,需要考虑包的依赖
- 选项
-i 安装 -r 卸载 -l 查看软件的信息 -L 查看软件的安装目录
- 命令
sudo dpkg -i wps-office_10.1.0.5672~a21_amd64.deb
3.源码安装
需要对源码进行编译进行安装。
- 步骤
a. 配置configure
./configure --prefix=/usr/local/nginx/
b.编译
make
c.安装
make install
- 示例:
tar -zxvf nginx-1.13.7.tar.gz #解压 cd nginx-1.13.7/#解压之后会有一个详细的文件夹,进入到文件夹 ./configure --prefix=/usr/local/nginx/#配置到这个地方 make#编译 sudo make install #安装 cd /usr/local/nginx/sbin/ sudo ./nginx #启动nginx #如果端口被占用, ps -ef | grep nginx sudo kill -9 pid
进程查看与结束
- 选项
- e 显示所有的进程
-f 显示完整的格式 - 格式
ps -ef | grep nginx - 命令
ps -ef | grep nginx #查看 sudo kill -9 12053 #结束进程的PID
更新镜像源
选用阿里源的镜像源 https://opsx.alibaba.com/mirror
- 步骤
- 备份文件:sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
- 新建软件:sudo vim /etc/apt/sources.list
- 更新软件包的列表信息:sudo apt-get update
deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial main deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
原文地址:https://www.jianshu.com/p/68e6f50f4368
相关推荐
-
kube-proxy的功能 服务器
2019-9-18
-
Oracle GoldenGate实现数据库同步 服务器
2019-9-1
-
如何快速构建中小企业应用上云架构的应对思路 服务器
2019-9-15
-
Linux设置静态IP 服务器
2019-10-16
-
从零开始搭建Prometheus自动监控报警系统 服务器
2019-9-6
-
Kyligence发布最新旗舰产品KAP 2.1,为Apache Kylin企业用户提供更快更强的大数据分析能力 服务器
2020-6-13
-
一文读懂HTTP/2及HTTP/3特性 服务器
2019-3-15
-
RPM安装软件 服务器
2019-8-19
-
MySQL 死锁专题问题处理 服务器
2020-5-31
-
一篇就弄懂HAProxy的常规用法 服务器
2019-11-2