liunx软件安装

系统开机慢
1.系统里安装的软件太多(开机是否启动)
2.c盘没有空间了,c盘只有20G空间比较小
重新安装系统后,原来安装在其他盘的软件都不能使用了。
windows里有个注册表(记录着软件的安装、路径等信息)
3.安装了多个杀毒软件(360、金山) 安装一个就可以了
=====
360安全卫士
控制面板---》程序
=====
优化
魔方
QQ软件管家
360安全卫士
不安装杀毒软件
=====
.exe
专杀工具
=====
360任务管理器---》了解所有的进程的信息,例如:那个公司开发的,做什么用的,会进行介绍
=====
msconfig ---》windows自带的开机启动项优化
360安全卫士 ---》也可以优化开机速度
=====
应用程序与系统命令的关系
文件位置
系统命令:一般在/bin和/sbin目录中,或为Shell内部指令
应用程序:通常在/usr/bin和/usr/sbin目录中
主要用途
系统命令:完成对系统的基本管理工作,例如IP配置工具
应用程序:完成相对独立的其他辅助任务,例如网页浏览器
适用环境
系统命令:一般只在字符操作界面中运行
应用程序:根据实际需要,有些程序可在图形界面中运行
运行格式
系统命令:一般包括命令字、命令选项和命令参数
应用程序:通常没有固定的执行格式
===
[root@teacher vnc]# echo $PATH 查看PATH变量的路径,一般命令都存放在这些路径下
/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
=====
/bin 一般用户都可以使用
/sbin 非常重要的命令(会涉及到系统安全和重要信息的),并不是所有用户都可以使用的
=====
C:\Windows\System32
=====
windows 安装程序 .exe
=====
.rpm --->redhat package manager
.deb --->debian ubuntu
.tar.gz .tar.bz2 .tar.xz ---->linux下源码包
setup安装程序 --->永中office

=====
rpm包是别人使用工具将tar包制作出来的
tar包---》srpm包---》rpm包
原材料 半成品 成品
=========
[root@teacher vnc]# ping 8.8.8.8
connect: Network is unreachable 没有添加网关
[root@teacher vnc]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.194.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
10.0.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
120.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
[root@teacher vnc]# route add default gw 10.0.0.254
===
rpmfind.net
http://rpm.pbone.net/
官方网站一般没有rpm下载,只有源码包下载
===
httpd-2.2.3-78.el5.centos.i386.rpm
===
从镜像光盘里获得rpm包
[root@teacher vnc]# find / -name rhel*.iso
/var/ftp/software/iso/rhel6.3.x86.iso
[root@teacher vnc]# du -sh /var/ftp/software/iso/rhel6.3.x86.iso
2.9G /var/ftp/software/iso/rhel6.3.x86.iso
[root@teacher vnc]#
挂载镜像光盘
[root@teacher vnc]# mkdir /iso 新建挂载点
[root@teacher vnc]# mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /iso
-o loop 是挂载镜像文件的时候使用的

[root@teacher vnc]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 321G 143G 162G 47% /
tmpfs tmpfs 1.9G 308K 1.9G 1% /dev/shm
/dev/sda1 ext4 92G 233M 87G 1% /boot
/var/ftp/software/iso/rhel6.3.x86.iso
iso9660 2.9G 2.9G 0 100% /iso
[root@teacher vnc]#
进入挂载点,开始使用/iso里的文件
[root@teacher iso]# ls
EULA RELEASE-NOTES-kn-IN.html
GPL RELEASE-NOTES-ko-KR.html
HighAvailability RELEASE-NOTES-ml-IN.html
images RELEASE-NOTES-mr-IN.html
isolinux RELEASE-NOTES-or-IN.html
LoadBalancer RELEASE-NOTES-pa-IN.html
media.repo RELEASE-NOTES-pt-BR.html
Packages RELEASE-NOTES-ru-RU.html
README RELEASE-NOTES-si-LK.html
RELEASE-NOTES-as-IN.html RELEASE-NOTES-ta-IN.html
RELEASE-NOTES-bn-IN.html RELEASE-NOTES-te-IN.html
RELEASE-NOTES-de-DE.html RELEASE-NOTES-zh-CN.html
RELEASE-NOTES-en-US.html RELEASE-NOTES-zh-TW.html
RELEASE-NOTES-es-ES.html repodata
RELEASE-NOTES-fr-FR.html ResilientStorage
RELEASE-NOTES-gu-IN.html RPM-GPG-KEY-redhat-beta
RELEASE-NOTES-hi-IN.html RPM-GPG-KEY-redhat-release
RELEASE-NOTES-it-IT.html Server
RELEASE-NOTES-ja-JP.html TRANS.TBL
[root@teacher iso]# cd Packages/
===
依赖关系
A-->B--->C
安装A必须要安装B和C软件
===
查询
rpm {-q|--query}
query-options
[-c,--configfiles] [-d,--docfiles]
[-i,--info] [-l,--list]

===
windows ---》regedit 打开注册表 存放系统里的软件的信息
linux ---》/var/lib/rpm 数据库--》安装的软件的信息
====
[root@teacher Packages]# rpm -qa|grep mysql 查看安装过得与mysql相关的软件
mysql-libs-5.1.61-4.el6.i686
mysql-test-5.1.61-4.el6.i686
mysql-bench-5.1.61-4.el6.i686
mysql-connector-odbc-5.1.5r1144-7.el6.i686
mysql-devel-5.1.61-4.el6.i686
mysql-connector-java-5.1.17-6.el6.noarch
mysql-5.1.61-4.el6.i686
mysql-server-5.1.61-4.el6.i686
php-mysql-5.3.3-3.el6_2.8.i686
[root@teacher Packages]#
[root@teacher Packages]# rpm -q vsftpd
vsftpd-2.2.2-11.el6.i686
[root@teacher Packages]# rpm -q vsftpddd
package vsftpddd is not installed 没有安装
[root@teacher Packages]#
===
[root@teacher Packages]# rpm -qi firefox 查询已经安装的firefox软件的信息
Name : firefox Relocations: (not relocatable) 不支持自定义安装路径,只能使用默认的路径
Version : 10.0.5 Vendor: Red Hat, Inc.
Release : 1.el6_2 Build Date: Fri 01 Jun 2012 09:58:03 PM CST
Install Date: Sat 09 Mar 2013 02:14:47 PM CST Build Host: x86-010.build.bos.redhat.com
Group : Applications/Internet Source RPM: firefox-10.0.5-1.el6_2.src.rpm
Size : 24474905 License: MPLv1.1 or GPLv2+ or LGPLv2+
Signature : RSA/8, Tue 05 Jun 2012 07:36:36 PM CST, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc.
URL : http://www.mozilla.org/projects/firefox/ 官方网站
Summary : Mozilla Firefox Web browser
Description :
Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance and portability.
[root@teacher Packages]#
=====
URL 统一资源定位符
http://www.mozilla.org/projects/firefox/
http:// 协议
www.mozilla.org 服务器的地址
projects/firefox/ 目录的路径
====
[root@teacher Packages]# rpm -ql vsftpd 查看软件安装到那些地方了
/etc/logrotate.d/vsftpd
/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.2.2
/usr/share/doc/vsftpd-2.2.2/AUDIT
=====
[root@teacher ftp]# rpm -qc vsftpd 查看配置文件
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf ##主要配置文件
[root@teacher ftp]#
[root@teacher lianxi]# tree
.
├── guolicheng
├── hosts
├── hunantv
│ └── qingshu
├── jingzhou
│ ├── honghu
│ │ └── shasi
│ └── songzhi
│ └── song
├── jubaopeng
│ ├── liubowen
│ └── shenwanshan
└── wanglaoji

11 directories, 2 files
[root@teacher lianxi]# which tree 查看tree命令的路径
/usr/bin/tree
[root@teacher lianxi]# rpm -qf /usr/bin/tree 查看tree命令是通过那个软件安装过来的
tree-1.5.3-2.el6.i686
[root@teacher lianxi]# rpm -qf `which tree ` 等效于上面2条命令
tree-1.5.3-2.el6.i686
[root@teacher lianxi]#
=========
练习:
1.查看机器里是否安装gcc相关的工具(软件名中包含gcc的软件)
2.查看机器是否安装httpd软件,查看httpd软件的官方网站和主要配置文件的路径
3.查看ifconfig命令是通过那个软件安装过来的
4.统计系统里一共安装了多少个软件包
5.查找出Take Screenshot 截图软件是通过那个软件安装过来的














练习:
1.查看机器里是否安装gcc相关的工具(软件名中包含gcc的软件)
[root@teacher lianxi]# rpm -qa|grep gcc
libgcc-4.4.6-4.el6.i686
gcc-4.4.6-4.el6.i686
[root@teacher lianxi]#
2.查看机器是否安装httpd软件,查看httpd软件的官方网站和主要配置文件的路径
rpm -q httpd
rpm -qi httpd
rpm -qc httpd
3.查看ifconfig命令是通过那个软件安装过来的
[root@teacher lianxi]# which ifconfig
/sbin/ifconfig
[root@teacher lianxi]# rpm -qf /sbin/ifconfig
net-tools-1.60-110.el6_2.i686
命令名不一定就是软件名
===
4.统计系统里一共安装里多少个软件包
rpm -qa|wc -l
5.查找出Take Screenshot 截图软件是通过那个软件安装过来的
思路:查找出具体的命令---》which ---》rpm -qf --》软件
1.[root@teacher lianxi]# find /usr/bin/ -name *screenshot*
/usr/bin/gnome-screenshot
/usr/bin/pilot-read-screenshot
/usr/bin/gnome-panel-screenshot
/usr/bin/gdm-screenshot
2.查看快捷方式的属性,得到具体的命令
3.查看进程,因为你在截图的时候,会产生进程
4.查看help
[root@teacher lianxi]# ps aux|grep screen
root 2944 0.0 0.0 19756 2976 ? Ss 08:26 0:00 gnome-screensaver
root 3142 0.3 0.1 13568 6216 pts/0 S 08:27 0:40 vncviewer 10.0.0.253:3 -fullscreen -shared
root 3244 0.0 0.0 19736 2660 ? Ss 08:27 0:00 gnome-screensaver
root 4269 0.2 0.3 164916 13400 pts/0 Sl 11:39 0:00 gnome-screenshot --interactive
root 4275 0.0 0.0 165104 3804 pts/0 S 11:40 0:00 gnome-screenshot --interactive
root 4286 0.0 0.0 4340 748 pts/1 S+ 11:41 0:00 grep screen
====
ps aux 查看所有的进程
====
[root@teacher Packages]# pwd
/iso/Packages
[root@teacher Packages]# ls wireshark-*
wireshark-1.2.15-2.el6_2.1.i686.rpm
wireshark-gnome-1.2.15-2.el6_2.1.i686.rpm
[root@teacher Packages]# rpm -qpi wireshark-1.2.15-2.el6_2.1.i686.rpm 未安装的
warning: wireshark-1.2.15-2.el6_2.1.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Name : wireshark Relocations: (not relocatable)
Version : 1.2.15 Vendor: Red Hat, Inc.
Release : 2.el6_2.1 Build Date: Wed 11 Apr 2012 03:29:30 PM CST
Install Date: (not installed) Build Host: x86-010.build.bos.redhat.com
Group : Applications/Internet Source RPM: wireshark-1.2.15-2.el6_2.1.src.rpm
Size : 48596842 License: GPL+
Signature : RSA/8, Thu 19 Apr 2012 04:48:30 PM CST, Key ID 199e2f91fd431d51
Packager : Red Hat, Inc.
URL : http://www.wireshark.org/
Summary : Network traffic analyzer
Description :
Wireshark is a network traffic analyzer for Unix-ish operating systems.

This package lays base for libpcap, a packet capture and filtering
library, contains command-line utilities, contains plugins and
documentation for wireshark. A graphical user interface is packaged
separately to GTK+ package.
[root@teacher Packages]#
[root@teacher Packages]#
====
已经安装的
rpm -q vsftpd
没有安装的,查询信息需要接-p选项,而且需要接软件包的全名
====
[root@teacher Packages]# elinks http://www.baidu.com 文本的浏览器
[root@teacher Packages]# lnyx http://www.baidu.com
====
查询未安装的RPM包文件
格式:rpm -qp[子选项] RPM包文件
用法:结合不同的子选项 完成不同查询
-qpi:通过.rpm包文件查看该软件的详细信息
-qpl:查看.rpm安装包内所包含的目录、文件列表
=====
安装或升级RPM软件
格式:rpm [选项] RPM包文件...
用法:不同选项适用于不同情况
-i:安装一个新的rpm软件包 (install)
-U:升级某个rpm软件,若原本未装,则进行安装(update)
-F:更新某个rpm软件,若原本未装,则放弃安装(freshen)
卸载指定的RPM软件(erase)
格式:rpm -e 软件名
====
--force:强制安装所指定的rpm软件包
--nodeps:安装、升级或卸载软件时,忽略依赖关系
-h:以“#”号显示安装的进度
-v:显示安装过程中的详细信息

========
[root@teacher Packages]# rpm -e nss_compat_ossl elinks
[root@teacher Packages]# rpm -ivh elinks-0.12-0.20.pre5.el6.i686.rpm
warning: elinks-0.12-0.20.pre5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
libnss_compat_ossl.so.0 is needed by elinks-0.12-0.20.pre5.el6.i686
[root@teacher Packages]# rpm -ivh elinks-0.12-0.20.pre5.el6.i686.rpm nss_compat_ossl-0.9.6-1.el6.i686.rpm
warning: elinks-0.12-0.20.pre5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:nss_compat_ossl ########################################### [ 50%]
2:elinks ########################################### [100%]
[root@teacher Packages]#
==
yum出问题的时候的解决方法:
[root@teacher lianxi]# kill -9 17254
[root@teacher lianxi]# rm -rf /var/run/yum.pid
[root@teacher lianxi]#
====
[root@teacher Packages]# rpm -ivh elinks-0.12-0.20.pre5.el6.i686.rpm --nodeps --force 强制安装不检查依赖关系,这样会导致软件安装好了,但是不能正常使用的情况
warning: elinks-0.12-0.20.pre5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:elinks ########################################### [100%]
[root@teacher Packages]# elinks www.baidu.com 不能正常使用
elinks: error while loading shared libraries: libnss_compat_ossl.so.0: cannot open shared object file: No such file or directory
====
[root@teacher Packages]# rpm -e stardict stardict-dic-zh_CN
==
使用*来安装很多软件
[root@teacher stardict]# rpm -ivh stardict-* --nodeps --force
warning: stardict-3.0.2-1.el6.i686.rpm: Header V4 DSA/SHA1 Signature, key ID fac8d3c0: NOKEY
warning: stardict-dic-zh_CN-2.4.2-6.puias6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 41a40948: NOKEY
Preparing... ########################################### [100%]
1:stardict ########################################### [ 50%]
2:stardict-dic-zh_CN ########################################### [100%]
====
练习:
1.安装openoffice软件
====
[root@teacher stardict]#rpm -Uvh wget-1.12-1.4.el6.i686.rpm 升级更新
===
使用
[root@teacher lianxi]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.6.tar.gz
--2013-08-09 15:04:40-- http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.6.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn... 166.111.8.205, 2001:da8:200:102:250:56ff:febf:5bf8
Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.8.205|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6700153 (6.4M) [application/x-gzip]
Saving to: “httpd-2.4.6.tar.gz.1”

100%[=============================>] 6,700,153 965K/s in 5.6s

2013-08-09 15:04:46 (1.13 MB/s) - “httpd-2.4.6.tar.gz.1” saved [6700153/6700153]

[root@teacher lianxi]#

[root@teacher rpm]# rpm --rebuilddb 重新构建rpm数据库(注册表)
===
[root@teacher Packages]# ls /etc/inittab
ls: cannot access /etc/inittab: No such file or directory
[root@teacher Packages]# rpm -ivh initscripts-9.03.31-2.el6.i686.rpm
warning: initscripts-9.03.31-2.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
package initscripts-9.03.31-2.el6.i686 is already installed
[root@teacher Packages]# rpm -ivh initscripts-9.03.31-2.el6.i686.rpm --force
warning: initscripts-9.03.31-2.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:initscripts ########################################### [100%]
[root@teacher Packages]# ls /etc/inittab
/etc/inittab
[root@teacher Packages]#
=======
编译安装的优点
1.可以获得最新的软件(比较安全,bug比较少)
2.可以自己定义开启那些功能,安装到哪里
=======
解决wps的libstdc++的低版本问题
1 获取一个新版本的libstdc++

注: 这只是获取libstdc++的一种方法,任何方法获取libstdc++,只要版本大于4.5都可以

从http://packages.debian.org/sid/i386/libstdc++6/download ,下载一个包含libstdc++的deb文件

解压deb文件

$ ar vx 你下载的deb文件

$ tar xvf data.tar.gz

解压后的./usr/lib/i386-linux-gnu/libstdc++.so.6.0.17就是我们需要的文件 # 后面版本后可能随下载的文件不同略有区别


2 将获取的libstdc++.so放入wps的office6目录



3 检验

$ cd /opt/kingsoft/wps-office/office6 # 如果wps安装在其他目录,请对应修改路径

$ ldd wps > /dev/null

如果输出没有输出,或输出中不包含libstdc++,说明问题成功解决。
=====
2012qq--》.deb
mplayer
cmatrix
httpd--->www.apache.org
=====
http://sourceforge.net --->mplayer
===
http://www.mplayerhq.hu/design7/news.html
===
从官方网站下载软件后,计算下md5值和官方提供的md5进行比较,看是否一致,如果一样说明软件很正常
[root@teacher lianxi]# md5sum httpd-2.4.4.tar.gz
a2fed766e67c9681e0d9b86768f08286 httpd-2.4.4.tar.gz
[root@teacher lianxi]#
=========
[root@teacher lianxi]# rpm -qa |grep gcc
libgcc-4.4.6-4.el6.i686
gcc-4.4.6-4.el6.i686
[root@teacher lianxi]#
===
1.下载
2.解压
[root@teacher lianxi]# tar xf httpd-2.4.4.tar.gz
3.进入目录
[root@teacher lianxi]# cd httpd-2.4.4
[root@teacher httpd-2.4.4]# ls
ABOUT_APACHE CHANGES InstallBin.dsp README
acinclude.m4 config.layout LAYOUT README.platforms
Apache-apr2.dsw configure libhttpd.dsp ROADMAP
Apache.dsw configure.in LICENSE server
apache_probes.d docs Makefile.in srclib
ap.d emacs-style Makefile.win support
build httpd.dsp modules test
BuildAll.dsp httpd.spec NOTICE VERSIONING
BuildBin.dsp include NWGNUmakefile
buildconf INSTALL os
[root@teacher httpd-2.4.4]#

[root@teacher httpd-2.4.4]# ./configure --help 可以查看那些功能可以开启,那些功能默认情况,那些默认不开,指定安装路径等等
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
===
以--enable开头的选项说明默认情况下不开启,需要我们使用这个选项去打开这个功能
以--disable开头的选项说明默认情况下开启,需要我们使用这个选项去关闭这个功能
--enable-authn-anon anonymous user authentication control
--disable-authz-host host-based authorization control
需要开启ssl功能指定相关OpenSSL软件的路径
--with-ssl=PATH OpenSSL installation directory
====
了解软件的安装和使用,请阅读README文档 INSTALL文档
====
Simply; 经典步骤

./configure --prefix=/desired/path/of/apr
make 编译(是将c语言写的程序编译成二进制文件)
make install (将编译好的二进制文件复制到相应的目录下)


编译前的配置
[root@teacher httpd-2.4.4]# ./configure --prefix=/usr/local/apache3
作用是生成Makefile文件,后面的make(编译)会根据这个文件里的要求去执行
[root@teacher httpd-2.4.4]# ./configure --prefix=/usr/local/apache3
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no 缺APR-util软件
configure: error: APR-util not found. Please read the documentation.
[root@teacher httpd-2.4.4]#

=====
因为版本太高,很多配套软件在现有的系统里没有,需要额外安装
所有采用httpd-2.2.24.tar.gz
=====
INSTALL文件里说明的步骤
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start

=====
[root@teacher lianxi]# tar xf httpd-2.2.24.tar.gz
[root@teacher lianxi]# cd httpd-2.2.24
[root@teacher httpd-2.2.24]# ls
ABOUT_APACHE configure.in LAYOUT os
acinclude.m4 docs libhttpd.dep README
Apache.dsw emacs-style libhttpd.dsp README.platforms
build httpd.dep libhttpd.mak README-win32.txt
BuildAll.dsp httpd.dsp LICENSE ROADMAP
BuildBin.dsp httpd.mak Makefile.in server
buildconf httpd.spec Makefile.win srclib
CHANGES include modules support
config.layout INSTALL NOTICE test
configure InstallBin.dsp NWGNUmakefile VERSIONING
[root@teacher httpd-2.2.24]# vim README
[root@teacher httpd-2.2.24]# vim INSTALL
[root@teacher httpd-2.2.24]#
[root@teacher httpd-2.2.24]# ./configure --prefix=/usr/local/apache3 配置,指定安装路径
[root@teacher httpd-2.2.24]# make ;make install 编译和编译安装
=======
安装apr-util需要指定apr的安装路径
[root@teacher apr-util-1.5.2]# ./configure --with-apr=/usr/local/apr/
=========
安装httpd-2.2.24版本
1.安装apr---》apr-utils---》httpd-2.2.24
apr-1.4.6.tar.gz
apr-util-1.5.2.tar.gz
httpd-2.2.24.tar.gz
====
网络故障---配置ip地址
service NetworkManger stop 停止NetworkManger服务,管理网络连接的
chkconfig NetworkManger off 让NetworkManger服务开机不自动启动
service network restart 刷新网络服务
ifconfig eth0 10.0.3.*/16 *代表的有效范围(1-254)临时手工配置ip地址
===

1.安装apr---》apr-utils---》pcre---》httpd-2.2.24
=====
使用
先停用rpm方式安装的httpd软件
[root@teacher httpd-2.4.4]# service httpd stop
Stopping httpd: [ OK ]
[root@teacher httpd-2.4.4]#
[root@teacher httpd-2.2.24]# /usr/local/apache3/bin/apachectl stop
停止编译安装的httpd服务
[root@teacher httpd-2.2.24]# /usr/local/apache3/bin/apachectl start
启动编译安装的httpd服务
==
[root@teacher htdocs]# pwd
/usr/local/apache3/htdocs 真正存放网站的目录,你可以将网站存放在此
[root@teacher htdocs]# ls
index.html
[root@teacher htdocs]#
[root@teacher htdocs]# vim index.html 修改网站的首页文件
[root@teacher htdocs]# cat index.html

It works! feng


[root@teacher htdocs]#
最后使用firefox浏览器看效果
[root@teacher htdocs]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:30:67:F2:10:CF
inet addr:10.0.0.253 Bcast:10.0.255.255 Mask:255.255.0.0
inet6 addr: fe80::230:67ff:fef2:10cf/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19367647 errors:0 dropped:0 overruns:0 frame:0
TX packets:26700100 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:518229845 (494.2 MiB) TX bytes:2098296702 (1.9 GiB)
Interrupt:29 Base address:0x8000

[root@teacher htdocs]#
====
rpm方式安装的httpd软件的网站路径在
/var/www/html
====
[root@teacher htdocs]# cd /var/www/html/
[root@teacher html]# ls
101 102 103 1ban-linux 2ban-linux 3ban-linux passwd
[root@teacher html]# /usr/local/apache3/bin/apachectl stop 停止编译安装的httpd服务
[root@teacher html]# service httpd restart 重新启动rpm方式安装的httpd服务
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
[root@teacher html]#
=======
80 端口 httpd服务监听80端口
rpm方式和编译安装,采用一种就可以了

=======
要想看到网站目录里的目录和其他文件,供其他用户下载,建议把index.html文件删除
=======
绝对路径
[root@teacher bin]# /usr/local/apache3/bin/httpd -v 查看编译安装httpd软件的版本
Server version: Apache/2.2.24 (Unix)
Server built: Jun 1 2013 17:31:53
===
相对路径
[root@teacher bin]# pwd
/usr/local/apache3/bin
[root@teacher bin]# httpd -v 查看编译安装httpd软件的版本
Server version: Apache/2.2.15 (Unix)
Server built: Feb 7 2012 09:50:15
[root@teacher bin]#
===
作业:
1.安装mplayer,要求有图形界面,下载歌曲和电影看看效果
2.安装cmatrix 软件,到ftp服务器上都有软件
3.安装firefox浏览器能够显示flash效果的flash-plugin的rpm包软件 (ftp服务器上有)
===
yasm--》mplayer
[root@teacher MPlayer-1.1]# ./configure --enable-gui
make
make install

====
安装skin
[root@teacher skin]# ls
Blue-1.8.tar.bz2 standard-1.9.tar.bz2
[root@teacher skin]# tar xf Blue-1.8.tar.bz2
[root@teacher skin]# ls
Blue Blue-1.8.tar.bz2 standard-1.9.tar.bz2
[root@teacher skin]# cp Blue /usr/local/share/mplayer/skins/ -r
[root@teacher skin]#
[root@teacher skin]# cd /usr/local/share/mplayer/skins/
[root@teacher skins]# ls
Blue
[root@teacher skins]# mv Blue/ default
[root@teacher skins]#
===
确保gcc编译软件已经安装
===
[root@teacher MPlayer-1.1.1]# modprobe snd_pcm_oss
加载声卡驱动,解决没有声音的问题

===

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1.配置ip地址---》访问10.0.2.253
2.安装lftp软件
3.去下载httpd的软件
4.解压进入目录,开始安装


$ ./configure --prefix=/usr/local/apache3 指定安装路径
$ make 编译
$ make install 编译安装
$ /usr/local/apache3/bin/apachectl start 启动脚本
======
[root@localhost httpd-2.2.23]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu

Configuring Apache Portable Runtime library ...

checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Configuring APR library
Platform: i686-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.4.6
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/web/httpd-2.2.23/srclib/apr':
configure: error: no acceptable C compiler found in $PATH #没有gcc
See `config.log' for more details
configure failed for srclib/apr
[root@localhost httpd-2.2.23]# yum install gcc* make #安装gcc和make编译工具
===
[root@localhost apache2]# iptables -F 关闭防火墙(清除防火墙规则)
[root@localhost apache2]# /usr/local/apache2/bin/apachectl start
开启web服务
[root@localhost apache2]# /usr/local/apache2/bin/apachectl stop
停止web服务
==
使用firefox ip 访问
elinks 10.0.0.158
===
下载内容的网站
[root@localhost httpd-2.2.23]# cd /usr/local/apache2/ 安装目录
[root@localhost apache2]# ls
bin cgi-bin error icons lib man modules
build conf htdocs include logs manual
[root@localhost apache2]# cd conf 存放配置文件
[root@localhost conf]# vim httpd.conf

ServerName teacher.sxkeji.com:80 #修改
[root@localhost conf]# /usr/local/apache2/bin/apachectl restart 刷新
[root@localhost conf]# /usr/local/apache2/bin/apachectl stop 停止
[root@localhost conf]# /usr/local/apache2/bin/apachectl start 启动
====
rpm 方式安装httpd
编译安装httpd
=====
rpm方式的httpd服务和编译安装的httpd服务都会占有80端口,建议使用其中一个就可以
service httpd stop
service httpd start
service httpd restart
=====
存放网站的目录
[root@localhost htdocs]# cd /usr/local/apache2/htdocs/
[root@localhost htdocs]# ls
httpd index.html.bak mplayer
注意将index.html 改名为不是index.html就可以,或者删除,然后复制你想给别人提供的视频、音乐、软件等资料,就可以了
[root@localhost htdocs]#
====
作业是安装
所有的操作在虚拟机里进行
1.rpm方式安装vsftpd、squid、php、mysql、gcc-c++软件
2.编译安装httpd-2.4.6.tar.gz 安装目录为/usr/local/apache9,访问首页的内容要求显示自己的名字
[root@localhost htdocs]# lftp 10.0.2.253
lftp 10.0.2.253:~> cd software/
lftp 10.0.2.253:/software> mirror httpd/
Total: 1 directory, 7 files, 0 symlinks
lftp 10.0.2.253:/software> quit
[root@localhost htdocs]#
==
安装apr---》apr-utils---》pcre---》httpd-2.2.24
注意安装pcre的时候需要安装libtool和gcc-c++软件包
===
3.编译安装mplayer播放器
[root@localhost htdocs]# lftp 10.0.2.253
lftp 10.0.2.253:~> cd software/
lftp 10.0.2.253:/software> cd mplayer/
lftp 10.0.2.253:/software/mplayer> ls
-rw-r--r-- 1 0 0 11208088 Apr 09 19:33 MPlayer-1.1.tar.xz
drwxr-xr-x 2 0 0 4096 Apr 09 19:33 skin
-rw-r--r-- 1 0 0 4993018 Jun 01 12:19 tiexuedanxin.mp3
-rw-r--r-- 1 0 0 501452931 Jun 01 12:22 xiyou.rmvb
-rw-r--r-- 1 0 0 1436502 Jun 01 12:50 yasm-1.2.0.tar.gz
lftp 10.0.2.253:/software/mplayer>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

yum是一个工具,可以用来查询、安装、升级、卸载软件
YUM(Yellow dog Updater,Modified)
==
repository 仓库、资源
===
9e621fc619d1eccd6fb49237c666f0ce4c68f93fab753cf9a840c7600dc4f30a-comps-rhel6-Server.xml
用来解决依赖关系
===
默认情况下yum已经安装
===
YUM的基本工作流程如下:
服务器端:在服务器上面存放了所有的RPM软件包,然后以相关的功能去分析每个RPM文件的依赖性关系,将这些数据记录成文件存放在服务器的某特定目录内。
客户端:如果需要安装某个软件时,先下载服务器上面记录的依赖性关系文件(可通过WWW或FTP方式),通过对服务器端下载的纪录数据进行分析,然后取得所有相关的软件,一次全部下载下来进行安装。
===
仓库配置文件目录:/etc/yum.repos.d/
[root@teacher yum.repos.d]# cd /etc/yum.repos.d/
[root@teacher yum.repos.d]# ls
bak ftp.repo ftp_server.repo
建议保留一个.repo结尾的文件
前面的名字没有关系,关键是要以.repo结尾
===
[root@teacher yum.repos.d]#
YUM的缓存目录:/var/cache/yum
logfile=/var/log/yum.log
===
[root@teacher yum.repos.d]# vim /etc/yum.conf
[root@teacher yum.repos.d]# man 5 yum.conf
===
搭建本地yum源的步骤
在你的真实机器里(没有光驱)

1.确定iso镜像文件的位置
[root@teacher ~]# find / -name rhel*.iso -exec du -sh {} \;
2.9G /var/ftp/software/iso/rhel6.3.x86.iso
[root@teacher ~]#
确认镜像文件的大小和位置,防止是个损坏的镜像文件
2.新建一个仓库目录
mkdir /lifeng-yum
3.挂载镜像文件到/media目录(不一定非要到/media),主要是获得软件
[root@teacher ~]# mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /media/

如果你有光驱也有光盘,可以使用(真实服务器和虚拟机里可以使用)
mount /dev/cdrom /media
4.查看挂载
[root@teacher ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 321G 142G 163G 47% /
tmpfs tmpfs 1.9G 336K 1.9G 1% /dev/shm
/dev/sda1 ext4 92G 233M 87G 1% /boot
/var/ftp/software/iso/rhel6.3.x86.iso
iso9660 2.9G 2.9G 0 100% /media
[root@teacher ~]#
5.将挂载点目录/media目录下的所有文件复制到/lifeng-yum目录下
[root@teacher ~]# cp /media/* /lifeng-yum/ -r
6.进入yum仓库配置文件存放目录
[root@teacher ~]# cd /etc/yum.repos.d/
[root@teacher yum.repos.d]#
[root@teacher yum.repos.d]# vim local.repo
[local_yum] #yum源的名字
name=local #yum源的描述
baseurl=file:///lifeng-yum 定位你的yum源的位置
enabled=1 #启用yum源 为0说明yum源不可用
gpgcheck=0 #不进行gpg检测,0代表不检测,1代表检测 :目的是为了安全性考虑
gpgkey=file:////etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 存放公钥文件
===
卸载镜像光盘
[root@teacher dutao_yum]# umount /dutao_yum/
umount: /dutao_yum: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@teacher dutao_yum]# cd
[root@teacher ~]# pwd
/root
[root@teacher ~]# umount /dutao_yum/

===
url 统一资源定位符(URL,英语UniformResourceLocator的缩写)也被称为网页地址,是因特网上标准的资源的地址。
file:// 协议
http://
ftp://
/lifeng-yum 目录的路径
http://www.baidu.com/abc/meinv.jpg
===
本地YUM源测试
为了避免其他repo文件干扰,保证/etc/yum.repos.d目录下只有一个repo文件
==
[root@teacher 6Server]# pwd
/var/cache/yum/i386/6Server
[root@teacher 6Server]#
===
[root@teacher 6Server]# ls
local_yum
[root@teacher 6Server]# rm -rf *
[root@teacher 6Server]#
==
[root@teacher 6Server]# yum list 查看那些软件安装了,那些软件没有安装
GConf2.i686 软件名 2.28.0-6.el6 版本 @anaconda-Re 使用那个yum源安装的@后接的名字
installed 说明是使用rpm方式安装的
==
dHatEnterpriseLinux-201206132153.i386/6.3
GConf2-devel.i686 2.28.0-6.el6 @ds
[root@teacher 6Server]# yum list|grep @local_yum
Unable to read consumer identity
squid.i686 7:3.1.10-1.el6_2.4 @local_yum
===
yum-presto.noarch 0.6.2-1.el6 local_yum 没有安装的软件
zsh.i686 4.3.10-5.el6 local_yum
==
[root@teacher 6Server]# yum install gcc*
[root@teacher 6Server]# yum install gcc* -y 自动安装 -y表示同意安装
===
yum clean all 清除缓存信息
===
练习:
使用yum命令完成
1.卸载wget、vsftpd、httpd、squid软件
2.安装所有与php、gcc、mysql相关的软件
3.查看本机安装了那些软件组
4.查看本机是否安装中文语言支持包
5.查看本机是否安装了mplayer软件
==
图形界面下的添加/删除程序能使用,yum源的配置文件要正确
==
本地yum源只能为本机提供软件管理的服务,不能为其他的机器提供服务。
1.搭建yum源---》将镜像光盘里的内容复制或者挂载到某个目录下
2.新建或者修改/etc/yum.repos.d/目录下的以.repo结尾的文件
===
[root@teacher yum.repos.d]# yum update 升级所有的软件
===
[root@teacher yum.repos.d]# yum grouplist
Loaded plugins: product-id, refresh-packagekit, security,
: subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Group Process
已经安装的
Installed Groups:
Installed Language Groups:
没有安装的
Available Groups:
Available Language Groups:
===
[root@teacher yum.repos.d]# yum groupinstall Eclipse
[root@teacher yum.repos.d]# yum groupinstall Eclipse "KDE Desktop"
安装多个组件
===
[root@teacher yum.repos.d]# yum groupinstall Desktop "Chinese Support"
===
[root@teacher yum.repos.d]# yum reinstall squid 重新安装
===
导入GPG公钥
[root@teacher yum.repos.d]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@teacher yum.repos.d]#
[root@teacher yum.repos.d]# cat local.repo
[local_yum]
name=local
baseurl=file:///lifeng-yum
enabled=1
gpgcheck=1 #进行gpg检查
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[root@teacher yum.repos.d]#
===
不能通过yum方式安装notecase
[root@teacher yum.repos.d]# yum install notecase
Loaded plugins: product-id, refresh-packagekit, security,
: subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Nothing to do
[root@teacher yum.repos.d]#
==
使用yum方式安装notecase realplayer
1.安装createrepo
[root@teacher yum.repos.d]# yum install createrepo
2.将自己从外面获得的rpm包放到/lifeng-yum/Packages目录下
[root@teacher Packages]# cd /lifeng-yum/Packages/
[root@teacher Packages]# lftp 10.0.0.253
lftp 10.0.0.253:~> cd software/notecase/
lftp 10.0.0.253:/software/notecase> get notecase
notecase-1.9.8-1.fc6.i386.rpm 下载notecase
notecase-1.9.8_portable.zip
notecase-1.9.8_slack.tar.gz
notecase_1.9.8-0ubuntu3_i386.deb
notecase_1.9.8_amd64.deb
lftp 10.0.0.253:/software/notecase> get notecase-1.9.8-1.fc6.i386.rpm
764870 bytes transferred
lftp 10.0.0.253:/software/notecase> quit
[root@teacher Packages]#
[root@teacher Packages]# lftp 10.0.0.253
lftp 10.0.0.253:~> cd software/
lftp 10.0.0.253:/software> get RealPlayer11GOLD.rpm 下载realplayer
8631282 bytes transferred
lftp 10.0.0.253:/software> quit
[root@teacher Packages]#

=======
3.重新生成解决依赖关系的目录
[root@teacher lifeng-yum]# cd /lifeng-yum/
[root@teacher lifeng-yum]# rm -rf repodata/ 删除解决依赖关系的目录
[root@teacher lifeng-yum]# createrepo /lifeng-yum/ 重新生成
=======
注意事项
[root@teacher yum.repos.d]# yum clean all
[root@teacher yum.repos.d]# yum install RealPlayer
[root@teacher yum.repos.d]# cat local.repo
[local_yum]
name=local
baseurl=file:///lifeng-yum
enabled=1
gpgcheck=0 #不检查gpg签名
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[root@teacher yum.repos.d]#
===
使用centos更新所有的软件?
条件:确保你的centos机器能上网
===
ubuntu
centos
都采用类似的yum的方式管理软件
====

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.最快的方式搭建本地yum源
2.ftp方式yum
3.centos的yum源使用
====

最快的方式搭建本地yum源
1.新建挂载点
[root@teacher ~]# mkdir /iso-hou
[root@teacher ~]#
2.挂载镜像文件
[root@teacher ~]# mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /iso-hou
[root@teacher ~]#
[root@teacher ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 321G 145G 160G 48% /
tmpfs tmpfs 1.9G 300K 1.9G 1% /dev/shm
/dev/sda1 ext4 92G 233M 87G 1% /boot
/var/ftp/software/iso/rhel6.3.x86.iso
iso9660 2.9G 2.9G 0 100% /iso-hou
[root@teacher ~]#
===
修改.repo文件,指定yum源的路径
[root@teacher ~]# cd /etc/yum.repos.d/
[root@teacher yum.repos.d]# ls
bak bak2 local.repo
[root@teacher yum.repos.d]#
[root@teacher yum.repos.d]# vim local.repo
[root@teacher yum.repos.d]# cat local.repo
[local_yum]
name=local
baseurl=file:///iso-hou #修改yum源的路径为光盘挂载目录
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[root@teacher yum.repos.d]#
=======
[root@teacher yum.repos.d]# yum clean all #清除yum缓存
Loaded plugins: product-id, refresh-packagekit, security,
: subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning repos: local_yum
Cleaning up Everything
[root@teacher yum.repos.d]# cd /var/cache/yum/i386/6Server/ #进入缓存目录
[root@teacher 6Server]#
[root@teacher local_yum]# ls
c91584368ad415e56cb23eb5b29d3fe4f8d0847c0e7664c5adcdf26493e19adb-primary.sqlite
cachecookie
gen
packages
productid.gz
repomd.xml
[root@teacher local_yum]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security,
: subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning repos: local_yum
Cleaning up Everything
[root@teacher local_yum]# ls
gen packages productid.gz
[root@teacher local_yum]#
====
开机自动挂载光盘镜像文件
1.将mount命令写到/etc/rc.local文件里,开机自动运行这条命令
[root@teacher local_yum]# echo mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /iso-hou >> /etc/rc.local
[root@teacher local_yum]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
arp -s 10.0.0.111 00:30:67:f2:0f:55
mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /iso-hou
[root@teacher local_yum]#
=======
/etc/rc.local 相当于windows里的“启动”文件夹,只要将命令写到/etc/rc.local文件就会开机自动运行
=======
[root@teacher vnc]# yum install squid -y
=======
rpm -e 卸载 与yum remove 卸载的区别?
在服务器上卸载软件的时候尽量不要使用yum remove
=======
只下载软件,不安装软件
[root@teacher local_yum]# rpm -qf `which yumdownloader`
yum-utils-1.1.30-14.el6.noarch
[root@teacher local_yum]#yum install yum-utils -y 安装yum工具包
[root@teacher local_yum]# man yumdownloader
[root@teacher local_yum]# yumdownloader --destdir=/var/tmp squid #下载squid软件包到/var/tmp目录下
Loaded plugins: presto, product-id, refresh-packagekit,
: versionlock
squid-3.1.10-1.el6_2.4.i686.rpm | 1.7 MB 00:00
[root@teacher local_yum]# ls /var/tmp #查看效果
kernel-2.6.32-279.el6.i686.rpm
squid-3.1.10-1.el6_2.4.i686.rpm
[root@teacher local_yum]#
=========
[root@teacher local_yum]# ping vault.centos.org
ping: unknown host vault.centos.org #不能进行dns解析
[root@teacher local_yum]# ping 8.8.8.8
connect: Network is unreachable #没有填网关

[root@teacher local_yum]# route add default gw 10.0.0.254
[root@teacher local_yum]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.194.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
10.0.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
120.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth0
[root@teacher local_yum]#

========
先ping 域名---》得到ip---》baidu或者ip138.com可以查询
www.ip138.com
=====
[root@teacher yum.repos.d]# lsb_release -a 查看linux系统的版本
LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.3 (Santiago)
Release: 6.3
Codename: Santiago
[root@teacher yum.repos.d]#
[root@teacher yum.repos.d]# cat /etc/issue 查看linux系统的版本
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m

=====
安装软件redhat-lsb
[root@teacher yum.repos.d]# rpm -qf `which lsb_release`
redhat-lsb-4.0-3.el6.i686
[root@teacher yum.repos.d]#yum install redhat-lsb
=====
redhat可以使用centos的yum源,注意版本要一致
[root@teacher yum.repos.d]# ls
bak bak2 centos.repo
[root@teacher yum.repos.d]# cat centos.repo
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://vault.centos.org/6.3/os/i386/ #官方yum源地址
gpgcheck=0

[root@teacher yum.repos.d]#
=====
ftp方式yum源搭建
1.安装vsftpd 这个ftp服务器软件
[root@teacher Packages]# pwd
/iso-hou/Packages
[root@teacher Packages]# rpm -vih vsftpd-2.2.2-11.el6.i686.rpm
两种安装方式
[root@teacher Packages]# yum install vsftpd
[root@teacher Packages]#
2.开启ftp服务
[root@teacher Packages]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@teacher Packages]#
3.新建yum仓库目录
[root@teacher Packages]# cd /var/ftp #进入ftp用户默认登录的路径目录下
[root@teacher ftp]# cat /etc/passwd|grep ftp #原因是ftp这个用户的家目录在/var/ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
[root@teacher ftp]#
[root@teacher ftp]# mkdir rhel6.3 新建仓库目录
[root@teacher ftp]# mount -o loop /var/ftp/software/iso/rhel6.3.x86.iso /var/ftp/rhel6.3/ 将镜像光盘挂载到仓库目录下
=====
4.修改/etc/yum.repos.d目录下的repo配置文件里的内容
[root@teacher yum.repos.d]# cd /etc/yum.repos.d/
[root@teacher yum.repos.d]# ls
bak bak2 centos.repo
[root@teacher yum.repos.d]# cat centos.repo
[ftp]
name=CentOS-$releasever - Base - 163.com
#baseurl=http://vault.centos.org/6.3/os/i386/
baseurl=ftp://10.0.0.253/rhel6.3 #指向ftp服务器的yum仓库目录
gpgcheck=0

[root@teacher yum.repos.d]#
5.测试
yum clean all
yum list
6.让vsftpd服务开机自动运行
[root@teacher yum.repos.d]# chkconfig vsftpd on 设置vsftpd服务在运行级别2,3,4,5里启动
[root@teacher yum.repos.d]# chkconfig --list vsftpd 查看vsftpd服务的在不同级别下的启动情况
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@teacher yum.repos.d]#
[root@teacher yum.repos.d]# chkconfig vsftpd off 关闭vsftpd服务开机启动
[root@teacher yum.repos.d]# chkconfig --list vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@teacher yum.repos.d]#
===========
注意:如果不能看到效果
1.ping 下ftp服务器的ip,是否通
2.关闭防火墙规则
iptables -F
3.关闭SELINUX
[root@teacher yum.repos.d]# getenforce 查看SELINUX的状态(selinux是linux下非常安全的一种机制,保障linux系统的安全的)
Disabled
[root@teacher yum.repos.d]# setenforce 0 设置selinux的状态为宽容模式,不起作用。这种方法临时有效
[root@teacher yum.repos.d]#
永久有效需要修改/etc/sysconfig/selinux 文件
[root@teacher yum.repos.d]# vim /etc/sysconfig/selinux
[root@teacher yum.repos.d]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX=disabled
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled #修改为disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
[root@teacher yum.repos.d]#

===
互相使用同桌的ftp方式yum源,测试
====
chkconfig NetworkManager off 让NetworkManager开机不启动
service NetworkManager stop 关闭NetworkManager服务
vim /etc/sysconfig/network-scripts/ifcfg-eth0 修改网卡的配置文件
[root@teacher ruijie]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes 将no更改为yes,开机自动激活网卡
service network restart 刷新网络服务
====











































































你可能感兴趣的:(Linux)