centos安装软件
centos安装软件一般下载好的安装包是.rpm后缀的。
比如aaa.rpm
打开终端进入到下载好的目录。
cd /home/用户名/下载
然后输入
yum localinstall aaa.rpm
或者
rpm -ivh aaa.rpm
如果是安装yum库里的软件,比如wget
那就直接打开终端,输入yum install wget就行了。
如果下载的是tar.gz的源码包
要进入下载的tar.gz的目录
比如
cd /home/用户名/下载
tar -xzvf XXX.tar.gz
./config
make
make install
就安装好了。
如果是.sh后缀的文件,
进入.sh文件的目录,
chmod +x XXX.sh修改权限
然后执行./XXX.sh linux版本多的让人烟花, 我就玩玩ubuntu 就行了。 逻辑卷的管理: http://dreamfire.blog.51cto.com/418026/1084729/ 修改hostname : http://www.cnblogs.com/kerrycode/p/3595724.html yum命令常见参数
yum是一个用于管理rpm包的后台程序,用python写成,可以非常方便的解决rpm的依赖关系。在建立好yum服务器后,yum客户端可以通过 http、ftp方式获得软件包,并使用方便的命令直接管理、更新所有的rpm包,甚至包括kernel的更新。它也可以理解为红旗环境下的apt管理工 具。
一、列举包文件
列出资源库中所有可以安装或更新的rpm包
# yum list
列出资源库中特定的可以安装或更新以及已经安装的rpm包
# yum list perl //列出名为perl的包
# yum list perl* //列出perl 开头的包
列出资源库中所有可以更新的rpm包
# yum list updates
列出已经安装的所有的rpm包
# yum list installed
列出已经安装的但是不包含在资源库中的rpm包
# yum list extras
注:extras是repos.d中定义的资源列表名称
二、列举资源信息
列出资源库中所有可以安装或更新的rpm包的信息
# yum info
列出资源库中特定的可以安装或更新以及已经安装的rpm包的信息
# yum info perl //列出perl 包信息
# yum info perl* //列出perl 开头的所有包的信息
列出资源库中所有可以更新的rpm包的信息
# yum info updates
列出已经安装的所有的rpm包的信息
# yum info installed
列出已经安装的但是不包含在资源库中的rpm包的信息
# yum info extras
三、搜索
搜索匹配特定字符的rpm包
# yum search perl //在包名称、包描述等中搜索
搜索有包含特定文件名的rpm包
# yum provides realplay
四、管理包
安装rpm包
# yum install perl //安装perl 包
# yum install perl* //安装perl 开头的包
删除rpm包,包括与该包有倚赖性的包
# yum remove perl* //会删除perl-* 所有包
五、更新
检查可更新的rpm包
# yum check-update
更新所有的rpm包
# yum update
更新指定的rpm包,如更新kernel和kernel source
# yum update kernel kernel-source
大规模的版本升级,与yum update不同的是,连旧的淘汰的包也升级
# yum upgrade
六、清空缓存
清除暂存中rpm包文件
# yum clean packages
清除暂存中rpm头文件
# yum clearn headers
清除暂存中旧的rpm头文件
# yum clean oldheaders
清除暂存中旧的rpm头文件和包文件
# yum clearn
或
# yum clearn all
七、其他
安装Livna.org rpms GPG key
# rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
检查GPG Key
# rpm -qa gpg-pubkey*
显示Key信息
# rpm -qi gpg-pubkey-a109b1ec-3f6e28d5
删除Key
# rpm -e gpg-pubkey-a109b1ec-3f6e28d5
yum配置与使用
yum的配置一般有两种方式,一种是直接配置/etc目录下的yum.conf文件,另外一种是在/etc/yum.repos.d目录下增加.repo文件。
一、yum的配置文件
$ cat /etc/yum.conf
cachedir=/var/cache/yum #yum下载的RPM包的缓存目录
keepcache=0 #缓存是否保存,1保存,0不保存。
debuglevel=2 #调试级别(0-10),默认为2(具体调试级别的应用,我也不了解)。
logfile=/var/log/yum.log #yum的日志文件所在的位置
exactarch=1 #在更新的时候,是否允许更新不同版本的RPM包,比如是否在i386上更新i686的RPM包。
obsoletes=1 #这是一个update的参数,具体请参阅yum(8),简单的说就是相当于upgrade,允许更新陈旧的RPM包。
gpgcheck=1 #是否检查GPG(GNU Private Guard),一种密钥方式签名。
plugins=1 #是否允许使用插件,默认是0不允许,但是我们一般会用yum-fastestmirror这个插件。
installonly_limit=3 #允许保留多少个内核包。
exclude=selinux* #屏蔽不想更新的RPM包,可用通配符,多个RPM包之间使用空格分离。
# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE or IN separate files named file.repo
# in /etc/yum.repos.d
二、*.repo文件详解
什么是repo文件?
repo文件是Fedora中yum源(软件仓库)的配置文件,通常一个repo文件定义了一个或者多个软件仓库的细节内容,例如我们将从哪里下载需要安装或者升级的软件包,repo文件中的设置内容将被yum读取和应用!
我们以一份系统自带的repo文件做为实例来探讨(#号后面是我加的注释):
#方括号里面的是软件源的名称,将被yum取得并识别
name=Fedora $releasever - $basearch #这里也定义了软件 仓库的名称,通常是为了方便阅读配置文件,一般没什么作用,$releasever变量定义了发行版本,通常是8,9,10等数字,$basearch变 量定义了系统的架构,可以是i386、x86_64、ppc等值,这两个变量根据当前系统的版本架构不同而有不同的取值,这可以方便yum升级的时候选择 适合当前系统的软件包,以下同……
failovermethod=priority #failovermethod 有两个值可以选择,priority是默认值,表示从列出的baseurl中顺序选择镜像服务器地址,roundrobin表示在列出的服务器中随机选择
exclude=compiz* *compiz* fusion-icon* #exclude这个选项是后来我自己加上去的,用来禁止这个软件仓库中的某些软件包的安装和更新,可以使用通配符,并以空格分隔,可以视情况需要自行添加
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
#上面的一行baseurl第一个字符是'#'表示该行已经被注释,将不会被读取,这一行的意思是指定一个baseurl(源的镜像服务器地址)
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
#上面的这一行是指定一个镜像服务器的地址列表,通常是开启的,本例中加了注释符号禁用了,我们可以试试,将$releasever和$basearch替换成自己对应的版本和架构,例如10和i386,在浏览器中打开,我们就能看到一长串镜可用的镜像服务器地址列表。
选择自己访问速度较快的镜像服务器地址复制并粘贴到repo文件中,我们就能获得较快的更新速度了,格式如下baseurl所示:
baseurl=
ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/10/Everything/i386/os
http://ftp.chg.ru/pub/Linux/fedora/linux/releases/10/Everything/i386/os
http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/Everything/i386/os
http://mirror.nus.edu.sg/fedora/releases/10/Everything/i386/os
http://mirror.yandex.ru/fedora/linux/releases/10/Everything/i386/os
http://ftp.twaren.net/Linux/Fedora/linux/releases/10/Everything/i386/os
http://ftp.itu.edu.tr/Mirror/Fedora/linux/releases/10/Everything/i386/os
enabled=1 #这个选项表示这个repo中定义的源是启用的,0为禁用
gpgcheck=1 #这个选项表示这个repo中下载的rpm将进行gpg的校验,已确定rpm包的来源是有效和安全的
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch #定义用于校验的gpg密钥
##以下的软件仓库基本上用不到,选项含义同上
name=Fedora $releasever - $basearch - Debug
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
name=Fedora $releasever - Source
failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch check-update 检查可提供的包升级
clean 删除缓存数据
deplist 列出包依赖相关
erase 移除一个或多个包从你的系统
groupinfo 显示关于包组的细节
groupinstall 从组里安装软件包到你的系统
grouplist 列出当前的组
groupremove 在一个组中移除包从您的系统
help 显示帮助用法信息
info 显示关于包或一组包的细节信息
install 安装一个或多个软件包在你的系统
list 列出一个包或某组的包
localinstall 安装本地 RPM
makecache 生成原数据缓存
provides Find what package provides the given value
reinstall 重新安装一个包
repolist 显示软件仓库的配置
resolvedep 决定哪个包提供了给定的依赖
search 查找包细节居给定的字符串
shell 运行交互式的yum shell
update 更新一个或多个包在你的系统
upgrade Update packages taking obsoletes into account
Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C 从缓冲中运行,而不是升级缓存
-c config file location
-R 最大化的命令等待时间
-d 调试输出级别
--showduplicates 显示复制, 在repo,list/search命令下
-e 错误输出级别
-q, --quiet 安静的操作
-v, --verbose verbose operation
-y 回答所有的问题为是
--version 显示 YUM版本信息并退出
--installroot=设置为root安装
--enablerepo= 激活一个或多个仓库(支持通配符)
--disablerepo=禁掉一个或多个仓库(支持通配符)
-x , --exclude= 在名称或glob不包含包。
--disableexcludes= disable exclude from main, for a repo or for everything
--obsoletes enable obsoletes processing during updates
--noplugins 禁掉yum插件
--nogpgcheck 禁掉GPG验证检查
--disableplugin= 用名称禁掉插件
--enableplugin= enable plugins by name
--skip-broken 忽略包的依赖问题
--color=COLOR control whether color is used http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/09/2203916.html 刚在X200上装了个linuxmint17,学习中☺ peacefeeling 发表于 2016-4-11 19:22
刚在X200上装了个linuxmint17,学习中☺
centos7 配置上的变化。。。。。。
http://www.cnblogs.com/panblack/p/Centos7-WhatsNew-01.html -------------centos7解决中文乱码问题
# cat /etc/locale.conf
LANG=en_US.UTF-8
# cp /etc/locale.conf /etc/locale.conf_bak
# vim /etc/locale.conf
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en"
SYSFONT="lat0-sun16"
~
~
~
# exit -----------------版本信息
$ cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
$ uname -m
x86_64
$ uname -r
3.10.0-123.el7.x86_64
$ uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ 回楼主,yum已经过时了,现在是dnf的时代。^u^ xliang9550 发表于 2016-4-25 23:01
回楼主,yum已经过时了,现在是dnf的时代。
dnf是什么?
vmware workstation pro下启用虚拟网卡
vi /etc/sysconfig/network-scripts/ifcfg-enoxxxxxx(一串数字)
修改boot=yes
:wq CentOS 7 运行级别切换
时间 2014-07-31 13:10:00博客园-原创精华区
原文http://www.cnblogs.com/lanston/p/3880577.html
主题 Centos systemd
CentOS 7 之前的版本是通过 /etc/inittab 文件来定义系统运行级别:
$ cat /etc/centos-release
CentOS release 6.4 (Final)
$ cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
$
CentOS 7 版本不再使用该文件定义系统运行级别,相关运行级别设置无效:
$ cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)
$ cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#
id:3:initdefault:#无效
$
新版本的运行级别都定义在 /lib/systemd/system下:
$ ls -ltr /lib/systemd/system/runlevel*
lrwxrwxrwx. 1 root root 13 7月30 14:22 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 15 7月30 14:22 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 17 7月30 14:22 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 7月30 14:22 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 7月30 14:22 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 7月30 14:22 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 7月30 14:22 /lib/systemd/system/runlevel6.target -> reboot.target
可以针对不同需要设置不同的运行级别:
如设置命令行级别方法:
ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target
或
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
或
systemctl set-default multi-user.target
设置窗口级别方法:
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
或
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
或
systemctl set-default graphical.target centos7中systemctl命令使用方法和心得体会
使用linux的同学对service和chkconfig两个命令都不陌生,其重要性不言而喻,那么怎么会突然冒出个systemctl命令呢?其实,为了简化操作,systemctl命令将service和chkconfig命令结合在了一起。这样通过一个命令就可以实现两个命令的功能。
方法/步骤
systemctl命令的基本操作格式是:
systemctl 动作 服务名.service
看一下--help的解释
centos7中systemctl命令使用方法和心得体会
在这里以httpd服务为例子,现在启动(关闭,重启)服务:
centos7中systemctl命令使用方法和心得体会
检查服务状态:
centos7中systemctl命令使用方法和心得体会
使服务开机启动:
centos7中systemctl命令使用方法和心得体会
取消服务开机启动:
centos7中systemctl命令使用方法和心得体会
centos7中systemctl命令使用方法和心得体会
6
总结:
使用systemctl命令,要记住start,stop,restart,status,enable,disable,is-enabled。就可以很好的使用! http://man.linuxde.net/systemctl http://jingyan.baidu.com/article/154b46317fdfce28ca8f419e.html http://www.cnblogs.com/chuncn/archive/2010/10/17/1853915.html 好复杂
页:
[1]