linux 账号管理 安装软件

应用程序与系统命令的关系

文件位置

               系统命令:一般在/bin和/sbin目录中,或为shell内部指令

               应用程序:通常在/usr/bin和/usr/sbin目录中

主要用途

              系统命令:完成对系统的基本管理工作

              应用程序:完成相对独立的其他辅助任务


 

/etc  存放配置文件

/var/log 存放日志文件

/usr/share/doc 应用程序文档


 

rpm软件包  扩展名为 ".rpm"  方便管理 

deb软件包  扩展名为".deb"

源代码包  "tar.gz" ,".tar.bz2" 通用性强,灵活性强,安装麻烦


 

rpm软件素材参考地址:http://rpmfind.net/

rpm  -qa 查看系统中已安装的所有软件包

[root@localhost tmp]# rpm -qa|grep ppp
rp-pppoe-3.5-32.1
ppp-2.4.4-1.el5
[root@localhost tmp]# 
 

[root@localhost tmp]# rpm -q vsftpd
vsftpd-2.0.5-10.el5
 

[root@localhost tmp]# rpm -qi vsftpd    //qi 查看所装软件包的信息
Name        : vsftpd                       Relocations: (not relocatable)
Version     : 2.0.5                             Vendor: Red Hat, Inc.
 


 


 

[root@localhost tmp]# rpm -ql vsftpd  //查看已安装软件包中所包含文件
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-2.0.5
/usr/share/doc/vsftpd-2.0.5/AUDIT
/usr/share/doc/vsftpd-2.0.5/BENCHMARKS
/usr/share/doc/vsftpd-2.0.5/BUGS
/usr/share/doc/vsftpd-2.0.5/COPYING
/usr/share/doc/vsftpd-2.0.5/Changelog
/usr/share/doc/vsftpd-2.0.5/EXAMPLE
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.0.5/FAQ
/usr/share/doc/vsftpd-2.0.5/INSTALL
/usr/share/doc/vsftpd-2.0.5/LICENSE
/usr/share/doc/vsftpd-2.0.5/README
/usr/share/doc/vsftpd-2.0.5/README.security
/usr/share/doc/vsftpd-2.0.5/REWARD
/usr/share/doc/vsftpd-2.0.5/SECURITY
/usr/share/doc/vsftpd-2.0.5/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.0.5/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.0.5/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.0.5/SECURITY/TRUST
/usr/share/doc/vsftpd-2.0.5/SIZE
/usr/share/doc/vsftpd-2.0.5/SPEED
/usr/share/doc/vsftpd-2.0.5/TODO
/usr/share/doc/vsftpd-2.0.5/TUNING
/usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub
 

[root@localhost tmp]# rpm -qc vsftpd  //查看已安装软件包中包含的配置文件
/etc/logrotate.d/vsftpd.log
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
 

[root@localhost tmp]# rpm -qd vsftpd   //查看软件包包含的文档信息
/usr/share/doc/vsftpd-2.0.5/AUDIT
/usr/share/doc/vsftpd-2.0.5/BENCHMARKS
/usr/share/doc/vsftpd-2.0.5/BUGS
/usr/share/doc/vsftpd-2.0.5/COPYING
/usr/share/doc/vsftpd-2.0.5/Changelog
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.xinetd.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/PER_IP_CONFIG/hosts.allow.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/README.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS/vsftpd.pam.dir
/usr/share/doc/vsftpd-2.0.5/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.0.5/FAQ
/usr/share/doc/vsftpd-2.0.5/INSTALL
/usr/share/doc/vsftpd-2.0.5/LICENSE
/usr/share/doc/vsftpd-2.0.5/README
/usr/share/doc/vsftpd-2.0.5/README.security
/usr/share/doc/vsftpd-2.0.5/REWARD
/usr/share/doc/vsftpd-2.0.5/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.0.5/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.0.5/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.0.5/SECURITY/TRUST
/usr/share/doc/vsftpd-2.0.5/SIZE
/usr/share/doc/vsftpd-2.0.5/SPEED
/usr/share/doc/vsftpd-2.0.5/TODO
/usr/share/doc/vsftpd-2.0.5/TUNING
/usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
 

[root@localhost tmp]# rpm -q --scripts vsftpd  //查看软件安装前或和安装后或卸载的脚本程序
postinstall scriptlet (using /bin/sh):
/sbin/chkconfig --add vsftpd
#/usr/sbin/usermod -d /var/ftp ftp >/dev/null 2>&1 || :
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
 /sbin/service vsftpd stop > /dev/null 2>&1
 /sbin/chkconfig --del vsftpd
fi
 

[root@localhost tmp]# rpm -q --changelog vsftpd //查看软件包版本升级的过程
 

[root@localhost tmp]# rpm -qf /etc/vsftpd/  //查看文件或者目录名 属于哪个rpm文件
vsftpd-2.0.5-10.el5
 

[root@localhost tmp]# rpm -qf /etc/vsftpd/vsftpd.conf 


 

[root@localhost tmp]# which ls
alias ls='ls --color=tty'
        /bin/ls
[root@localhost tmp]# rpm -qf /bin/ls
coreutils-5.97-12.1.el5
vsftpd-2.0.5-10.el5
 

查看未安装的rpm包文件[rpm  -qpi 软件包全称]

-qpi 软件包的详细信息

-qpl 所包含的目录或者文件

-qpc 所包含的配置内文件

-qpd 所包含的文档信息


 

rpm -ivh 安装软件

         -e 卸载软件

         -Uvh 升级某个rpm软件,若原本未安装,则进行安装

         -F   更新某个rpm软件,若原本未安装则放弃安装

辅助选项

--force:强制安装所指定的rpm软件包

--nodeps:安装、升级或者卸载软件时,忽略依赖关系

-h  以"#"显示安装进度

-v  显示安装过程的详细信息

  安装过程提示

NOKEY

密钥,验证软件包的完整性

[root@localhost tmp]# md5sum cptest 
d41d8cd98f00b204e9800998ecf8427e  cptest
 

rpm -e vsftpd 先卸载

rpm --import RPM-GPG-KEY-redhat-release导入密钥,然后再进行安装

当安装软件包时,系统会使用导入的key,对软件包进行验证,验证软件包的完整性

rpm --initdb 重新修复 rpm 数据库


 

yum 解决软件包的依赖关系

软件素材参考:http://sourceforge.net/

确认源代码编译环境

需安装支持C/C++程序语言的编译器

[root@localhost tmp]# rpm -qa |grep ^gcc*
gcc-objc-4.1.2-14.el5
gcc-c++-4.1.2-14.el5
gcc-4.1.2-14.el5

gcc-gnat-4.1.2-14.el5
gcc-java-4.1.2-14.el5
gcalctool-5.8.25-1.el5
gcc-gfortran-4.1.2-14.el5
[root@localhost tmp]# rpm -qa|grep make
make-3.81-1.1
automake14-1.4p6-13
automake16-1.6.3-8
imake-1.0.2-3
automake-1.9.6-2.1
automake17-1.7.9-7
automake15-1.5-16
[root@localhost tmp]# 
 


 

gcc -v 查看gcc的版本号


 

源码包的安装步骤

1、tar包解压缩

      解压并释放源代码包到指定目录

     解包后的源代码文件位置/usr/src/软件名-版本号

2、./configuration

      设置安装目录,安装模块等选项

3、make编译

      生成可执行的二进制文件

4、make install 

     复制二进制文件到系统,配置应用环境


 

yum 服务器配置


 

YUM  Yellodog Updater Modified

      可以自动解决依赖关系

     所有软件包由集中地YUM软件仓库提供

软件仓库的提供方式

      FTP服务:ftp://

      HTTP服务:http://

      本地服务:file:///

RPM软件包的来源

      mkdir  /var/ftp/rhel6

     cp -rf /misc/cd/*  /var/ftp/rhel6

     rpm -ivh vsftpd

     [root@localhost tmp]# chkconfig --level 35 vsftpd on 

     vsftpd服务在运行级别为3或者5时自动启动


 

     service vsftpd start

     service vsftpd status

     service vsftpd restart

     service vsftpd stop

mount /dev/cdrom /mnt //挂载即映射,将光盘中的内容映射到对应文件中,不占用实际空间

chkconfig --level 35 vsftpd on  将服务设置为开机自动启动


 

cp -rf /mnt/* /var/ftp

在软件仓库中加入非官方RPM包

包括存在依赖关系的所有RPM包

使用createrepo工具建立仓库数据文件

cd /var/ftp/other

createrepo -g /misc/cd/repodata/repomd.xml ./生成仓库数据文件

ls -lh repodata

repodata 软件仓库文件


 

客户机

[root@localhost tmp]# vi /etc/yum.repos.d/local.repo

[RHEL5.1]   //自定义标签,以示区分
name=RHEL5.1  
baseurl=file:///iso/as5.1/Server[也可以是ftp服务器的ip地址]
enabled=1 //要使用此repo文件
gpgcheck=1 //不验证光盘的完整性
 

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[other]

name=Other RPM Packages

baseurl=ftp://192.168.4.54/other

enabled=1 //要使用此repo文件

gpgcheck=0//不验证光盘的完整性

[root@localhost tmp]# yum clean all 清空缓存[换repo文件]
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
Loading "security" plugin

清空以下目录中的内容

cd /var/cache/yum

yum list和rpm -qa类似

yum info vsftpd和rpm -qi类似


 

[root@localhost yum.repos.d]# yum search "httpd"  //查找和httpd相关的软件包信息
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up repositories
Reading repository metadata in from local files
httpd.i386                               2.2.3-11.el5           RHEL5.1         
Matched from:
httpd
http://httpd.apache.org/

mod_ssl.i386                             1:2.2.3-11.el5         RHEL5.1         
Matched from:
http://httpd.apache.org/

httpd-manual.i386                        2.2.3-11.el5           RHEL5.1         
Matched from:
httpd-manual
The httpd-manual package contains the complete manual and
reference guide for the Apache HTTP server. The information can
also be found at http://httpd.apache.org/docs/2.2/.
http://httpd.apache.org/

system-config-httpd.noarch               5:1.3.3.1-1.el5        RHEL5.1         
Matched from:
system-config-httpd

httpd-devel.i386                         2.2.3-11.el5           RHEL5.1         
Matched from:
httpd-devel
The httpd-devel package contains the APXS binary and other files
that you need to build Dynamic Shared Objects (DSOs) for the
Apache HTTP Server.

If you are installing the Apache HTTP server and you want to be
able to compile or develop additional modules for Apache, you need
to install this package.
http://httpd.apache.org/

mod_dav_svn.i386                         1.4.2-2.el5            RHEL5.1         
Matched from:
The mod_dav_svn package allows access to a Subversion repository
using HTTP, via the Apache httpd server.

mod_ssl.i386                             1:2.2.3-11.el5         installed       
Matched from:
http://httpd.apache.org/

httpd.i386                               2.2.3-11.el5           installed       
Matched from:
httpd
http://httpd.apache.org/

httpd-manual.i386                        2.2.3-11.el5           installed       
Matched from:
httpd-manual
The httpd-manual package contains the complete manual and
reference guide for the Apache HTTP server. The information can
also be found at http://httpd.apache.org/docs/2.2/.

http://httpd.apache.org/
 

[root@localhost yum.repos.d]# yum grouplist //查看已分组的软件包
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
Setting up repositories
comps-rhel5-server-core.x 100% |=========================| 922 kB    00:00     
Installed Groups:
   Office/Productivity
   Development Libraries
   Editors
   System Tools
   GNOME Software Development
   Text-based Internet
   X Software Development
   GNOME Desktop Environment
   Authoring and Publishing
   FTP Server
   Network Servers
   Legacy Software Development
   Java Development
   X Window System
   Graphics
   Web Server
   Printing Support
   KDE (K Desktop Environment)
   Mail Server
   Server Configuration Tools
   Administration Tools
   Graphical Internet
Available Groups:
   Engineering and Scientific
   MySQL Database
   Legacy Network Server
   DNS Name Server
   Games and Entertainment
   Windows File Server
   KDE Software Development
   Sound and Video
   PostgreSQL Database
   News Server
   Development Tools
Done
[root@localhost yum.repos.d]# 
 


 

[root@localhost yum.repos.d]# yum groupinfo "X Window System" //查看组信息
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
Setting up repositories


Group: X Window System
 Description: Install this group of packages to use the base graphical (X) user interface.
 Mandatory Packages:
   xorg-x11-fonts-misc
   xorg-x11-server-Xorg
   xorg-x11-fonts-ISO8859-1-75dpi
   xorg-x11-fonts-100dpi
   xorg-x11-fonts-75dpi
   xorg-x11-xauth
   desktop-backgrounds-basic
   xorg-x11-fonts-ISO8859-1-100dpi
   xorg-x11-xinit
   xorg-x11-fonts-Type1
   xorg-x11-xfs
   xorg-x11-fonts-truetype
   bitmap-fonts
   xorg-x11-drivers
 Default Packages:
   xorg-x11-twm
   xorg-x11-apps
   pirut
   openssh-askpass
   rhn-setup-gnome
   liberation-fonts
   firstboot
   system-config-display
   freeglut
   gdm
   policycoreutils-gui
   rhgb
   synaptics
   krb5-auth-dialog
   system-config-soundcard
   xterm
   dejavu-lgc-fonts
   linuxwacom
   system-config-services
   vnc-server
   system-config-date
   glx-utils
   authconfig-gtk
   system-config-printer
   system-config-network
   bitstream-vera-fonts
   system-config-users
 Optional Packages:
   xorg-x11-utils
   xorg-x11-resutils
   xorg-x11-xfwp
   switchdesk
   xorg-x11-xsm
   xorg-x11-server-Xnest
   xorg-x11-xfs-utils
   xorg-x11-server-Xvfb
   ibmasm-xinput
[root@localhost yum.repos.d]#
 

yum install 软件包

yum groupinstall 包组名


 

yum update 软件包

yum groupupdate 包组名


 

yum -y install vsftpd


 

yum remove 软件名

yum groupremove 包组名

yum grouperase 包组名

不建议使用yum卸载软件包,会卸载软件包的所有依赖包,影响其他软件包的使用

推荐使用rpm -e 进行卸载


 

service NetworkManager stop

chkconfig --level 35 NetworkManager off

linux中ip改变不会自动生效需要重启网卡

当改变网卡自动回让ip地址生效,此服务作用,但有Bug,故禁用

vim /etc/sysconfig/network-scripts/ifcfg-eth0

NM_CONTROLLED=no 网卡是否受NetworkManager 服务控制,默认为yes

USERCTL=no 普通用户是否能修改

service network restart 重启网络服务

ip addr show


 

scp [email protected]:/etc/yum.repos.d/rhel.repo

ftp默认宿主目录为/var/ftp


 

yum-plugin-verify 允许yum检查软件包的完整性

yum-plugin-changelog 使用yum查看软件包changelog 

yum -y install yum-plugin-changelog

你可能感兴趣的:(linux,安装,账号)