Linux(ubuntu)安装软件

作者: 烤奶要加冰 | 来源:发表于2019-08-10 12:06 被阅读2次

在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  #解包并解压缩

安装软件

  1. 使用专门的命令安装,无需考虑包的依赖关系
  • 选项
install  安装软件包
remove  删除软件包
update  更新软件包
upgrade  进行一次系统的更新
  • 命令:sudo apt-get install openssh-server
    使用:
    • sudo service sshd start|stop
    • sudo ssh 用户名@IP地址
  1. 使用特定的安装包的命令安装,需要考虑包的依赖
  • 选项
-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

相关文章

  • Caffe 安装参考

    安装参考资料 Ubuntu 中软件的安装、卸载以及查看的方法总结 ubuntu14.04安装cuda Linux设...

  • 安装虚拟机和Linux

    教程,不用安装Ubuntu,安装深度Linux 1、下载虚拟机软件,Linux系统镜像 VMware Workst...

  • day33-Linux软件安装

    一、Linux安装软件 1.Linux发行版本 Redhat CentOS Ubuntu Fedora SUSE ...

  • 1208笔记

    1208Linux基础 1.Ubuntu下软件的安装 Ubuntu下支持的软件包格式:packagename.de...

  • R在Ubuntu16.04 LTS下安装

    安装R语言软件可以通过Ubuntu的apt-get工具进行安装.下面介绍在Linux Ubuntu中安装R语言的过程.

  • WGD (Whole Genome duplication)

    运行环境 Python3.5 & Python3.6 on Linux Ubuntu 依赖软件 安装 安装成功后 ...

  • 学习小组Day3笔记--Bossa

    Linux下安装软件 阿里云安装镜像为ubuntu 16.04,因此软件管理系统与centos不同,且自带bzip...

  • 第四天笔记

    linux - Ubuntu命令: 安装软件:sudo apt-get install软件名当前登录用户切换roo...

  • Linux(ubuntu)安装软件

    在Linux安装软件前,首先要了解压缩与解压缩。 压缩与解压缩 zip / unzip可以对多个文件和目录进行压缩...

  • ubuntu linux软件安装

    对于下载好的.deb文件: dpkg -i abc.deb 查看本机已安装的软件: dpkg -l结合gerp快速...

网友评论

    本文标题:Linux(ubuntu)安装软件

    本文链接:https://www.haomeiwen.com/subject/bxaljctx.html