linux 软件包管理
原创
©著作权归作者所有:来自51CTO博客作者胡桃小孩儿的原创作品,请联系作者获取转载授权,否则将追究法律责任
环境:
ubuntu 15.04
linux 软件包主要有:
.deb debian的安装格式
.tar/.tar.gz等 unix/linux压缩包,不过.tar只是将多个文件集中起来了,本身没有压缩
.rpm 在红帽系统下可直接安装。
tar的压缩和解压的命令:
压缩:
tar zcvf filename.tar.gz file1 file2 ……
tar zcvf dirname.tar.gz dirname1 dirname2 ……
解压:
tar -zxvf filename(含.tar.gz后缀名)
压缩和解压方法还有:
gzip filename(得到后缀名是.gz)
gunzip filename
edemon@linux:~$ mkdir test
edemon@linux:~$ cd test
edemon@linux:~/test$ touch t1 t2 t3
edemon@linux:~/test$ tar czvf t.tar.gz t1 t2 t3
t1
t2
t3
edemon@linux:~/test$ ls
t1 t2 t3 t.tar.gz
edemon@linux:~/test$ cd ..
edemon@linux:~$ ls
Desktop Downloads Music Public test
Documents examples.desktop Pictures Templates Videos
edemon@linux:~$ mkdir test2
edemon@linux:~$ tar czvf tdir.tar.gz test test2
test/
test/t1
test/t3
test/t.tar.gz
test/t2
test2/
edemon@linux:~$ ls
Desktop Downloads Music Public Templates test2
Documents examples.desktop Pictures tdir.tar.gz test Videos
edemon@linux:~$ tar -zxvf tdir.tar.gz
test/
test/t1
test/t3
test/t.tar.gz
test/t2
test2/
以shutter为例说明tar.gz软件包的安装:
edemon@linux:~/Downloads$ tar -zxvf shutter-0.88.tar.gz
edemon@linux:~/Downloads$ cd shutter-0.88/bin
edemon@linux:~/Downloads/shutter-0.88/bin$ sudo apt-get install shutter
//非deb文件用apt-get
一路yes即可
然后搜索找到shutter即能使用。

至于deb软件包安装很简单,双击自动运行。或者用命令:
edemon@linux:~/Downloads$ sudo dpkg -i filename
卸载:
edemon@linux:~$ sudo apt-get purge filename
安装Mysql :
(安装包是 .tar文件)
先下载目标文件:

解压:
edemon@linux:~/Downloads$ tar -xvf mysql-server_5.7.11-1ubuntu14.04_i386.deb-bundle.tar
解压后不是随便安装哪个deb,有顺序的。
初学,安装时我使用软件中心便于看提示:

先操作:
mysql-client_5.7.11-1ubuntu14.04_i386.deb
顺利安装
再尝试安装 Mysql Server,得先安装mysql-community-server

操作:mysql-community-server
安装 mysql server
对了,中途会提示设置root密码:

在终端试试:
edemon@linux:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.11 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2016-02-11 10:12:13 |
+---------------------+
1 row in set (0.03 sec)
mysql>
成功!
