一、            安装yum本地源

使用字符界面安装fedora  linux,很多rpm软件包并没有安装,如果使用rpm 命令来安装软件包,会因为软件包依赖的关系,使人感觉很烦。那有没有一种比较简单的方法,能避免自己去找软件包的依赖关系呢?答案是有的,那就是yum

Yum在安装rpm软件包是会自动的去寻找软件包的依赖关系,并自动的把依赖的软件包安装好。

 

1)      在使用yum前,我们需要先做一些准备工作。

1.1          如果linux是安装在VMware上,请在VMware中的cdrom中加载isolinux安装包Fedora-12-i386-DVD.iso,加载iso方法如下。

1.1.1     点击VMware软件的右下角

1.1.2     并在弹出框的选项中选择settings

1.1.3     选择use ISO image file,并选择正确的ISO存放路径

1.1.4     使用mount  –t  auto /dev/cdrom /mntVMwarecdromISO挂载到/mnt目录下          

2)      安装yum软件包

2.1  在把ISO镜像挂载到/mnt目录后,cd /mnt/Packages/跳转到rpm包的存放位置

2.2  安装yumrpm包:rpm -ivh yum-3.2.25-1.fc12.noarch.rpm

2.3  安装成功,提示下面信息

    [root@localhost Packages]# rpm -ivh yum-3.2.25-1.fc12.noarch.rpm

Preparing...    ########################################### [100%]

3)      配置本地yum

3.1  cd /etc/yum.repos.d/,在yum.repos.d目录下面建立一个fedora-iso.repo文件,并输入以下内容保存退出。

         [root@localhost yum.repos.d]# vi fedora-iso.repo

[dvd]

name=fedora-iso

baseurl=file:///mnt/

enabled=1

gpgcheck=0

gpgkey=file:///mnt/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

         3.2 yum.repos.d目录下的其他几个文件使用mv命令改成其他的名字。

                [root@localhost yum.repos.d]# mv fedora.repo fedora.repo.bak

         [root@localhost yum.repos.d]# mv fedora-updates-testing.repo fedora-updates-testing.repo.bak

         [root@localhost yum.repos.d]# mv fedora-rawhide.repo fedora-rawhide.repo.bak

         [root@localhost yum.repos.d]# mv fedora-updates.repo fedora-updates.repo.bak

4)      使用yum安装rpm包软件

网上有很多说要使用createrepo建立rpm包依赖数据库,其实在fedora12ISO中就已经有自己的已经关系数据库了,在ISOrepodata目录下。

4.1使用命令安装rpm包,如:yum localinstall samba-3.4.2-47.fc12.i686.rpm

         如果正确安装,过程如下:

         [root@localhost Packages]# yum localinstall samba-3.4.2-47.fc12.i686.rpm

Setting up Local Package Process

Examining samba-3.4.2-47.fc12.i686.rpm: samba-3.4.2-47.fc12.i686

Marking samba-3.4.2-47.fc12.i686.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package samba.i686 0:3.4.2-47.fc12 set to be updated

--> Processing Dependency: samba-common = 3.4.2-47.fc12 for package: samba-3.4.2-47.fc12.i686

--> Processing Dependency: /usr/bin/perl for package: samba-3.4.2-47.fc12.i686

--> Processing Dependency: libcups.so.2 for package: samba-3.4.2-47.fc12.i686

--> Running transaction check

---> Package cups-libs.i686 1:1.4.1-13.fc12 set to be updated

--> Processing Dependency: libavahi-common.so.3 for package: 1:cups-libs-1.4.1-13.fc12.i686

--> Processing Dependency: libgnutls.so.26(GNUTLS_1_4) for package: 1:cups-libs-1.4.1-13.fc12.i686

--> Processing Dependency: libjpeg.so.62 for package: 1:cups-libs-1.4.1-13.fc12.i686

--> Processing Dependency: libavahi-client.so.3 for package: 1:cups-libs-1.4.1-13.fc12.i686

--> Processing Dependency: libtiff.so.3 for package: 1:cups-libs-1.4.1-13.fc12.i686

--> Processing Dependency: libgnutls.so.26 for package: 1:cups-libs-1.4.1-13.fc12.i686

---> Package perl.i686 4:5.10.0-82.fc12 set to be updated

--> Processing Dependency: perl-libs = 4:5.10.0-82.fc12 for package: 4:perl-5.10.0-82.fc12.i686

--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.0-82.fc12.i686

--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.0-82.fc12.i686

--> Processing Dependency: perl-libs for package: 4:perl-5.10.0-82.fc12.i686

--> Processing Dependency: perl(version) for package: 4:perl-5.10.0-82.fc12.i686

--> Processing Dependency: libperl.so for package: 4:perl-5.10.0-82.fc12.i686

---> Package samba-common.i686 0:3.4.2-47.fc12 set to be updated

--> Processing Dependency: libtdb >= 1.1.3 for package: samba-common-3.4.2-47.fc12.i686

--> Processing Dependency: /usr/bin/pkg-config for package: samba-common-3.4.2-47.fc12.i686

--> Running transaction check

---> Package avahi.i686 0:0.6.25-5.fc12 set to be updated

--> Processing Dependency: libdaemon >= 0.11 for package: avahi-0.6.25-5.fc12.i686

--> Processing Dependency: libdaemon.so.0 for package: avahi-0.6.25-5.fc12.i686

---> Package gnutls.i686 0:2.8.5-1.fc12 set to be updated

--> Processing Dependency: libtasn1.so.3(LIBTASN1_0_3) for package: gnutls-2.8.5-1.fc12.i686

--> Processing Dependency: libtasn1.so.3 for package: gnutls-2.8.5-1.fc12.i686

---> Package libjpeg.i686 0:6b-46.fc12 set to be updated

---> Package libtdb.i686 0:1.1.5-2.fc12 set to be updated

---> Package libtiff.i686 0:3.8.2-15.fc12 set to be updated

---> Package perl-Module-Pluggable.i686 1:3.90-82.fc12 set to be updated

---> Package perl-Pod-Simple.i686 1:3.07-82.fc12 set to be updated

--> Processing Dependency: perl(Pod::Escapes) >= 1.03 for package: 1:perl-Pod-Simple-3.07-82.fc12.i686

---> Package perl-libs.i686 4:5.10.0-82.fc12 set to be updated

---> Package perl-version.i686 3:0.74-82.fc12 set to be updated

---> Package pkgconfig.i686 1:0.23-9.fc12 set to be updated

--> Running transaction check

---> Package libdaemon.i686 0:0.14-1.fc12 set to be updated

---> Package libtasn1.i686 0:2.3-1.fc12 set to be updated

---> Package perl-Pod-Escapes.i686 1:1.04-82.fc12 set to be updated

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================

 Package               Arch Version             Repository                 Size

================================================================================

Installing:

 samba                 i686 3.4.2-47.fc12       /samba-3.4.2-47.fc12.i686  14 M

Installing for dependencies:

 avahi                 i686 0.6.25-5.fc12       dvd                       232 k

 cups-libs             i686 1:1.4.1-13.fc12     dvd                       316 k

 gnutls                i686 2.8.5-1.fc12        dvd                       343 k

 libdaemon             i686 0.14-1.fc12         dvd                        27 k

  libjpeg               i686 6b-46.fc12          dvd                       126 k

 libtasn1              i686 2.3-1.fc12          dvd                       233 k

 libtdb                i686 1.1.5-2.fc12        dvd                        25 k

 libtiff               i686 3.8.2-15.fc12       dvd                       259 k

 perl                  i686 4:5.10.0-82.fc12    dvd                       8.7 M

 perl-Module-Pluggable i686 1:3.90-82.fc12      dvd                        32 k

 perl-Pod-Escapes      i686 1:1.04-82.fc12      dvd                        24 k

 perl-Pod-Simple       i686 1:3.07-82.fc12      dvd                       182 k

 perl-libs             i686 4:5.10.0-82.fc12    dvd                       738 k

 perl-version          i686 3:0.74-82.fc12      dvd                        34 k

  pkgconfig             i686 1:0.23-9.fc12       dvd                        64 k

  samba-common          i686 3.4.2-47.fc12       dvd                        11 M

 

Transaction Summary

================================================================================

Install      17 Package(s)

Upgrade       0 Package(s)

 

Total size: 37 M

Total download size: 22 M

Is this ok [y/N]: y

Downloading Packages:

--------------------------------------------------------------------------------

Total                                            32 MB/s |  22 MB     00:00    

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB has been altered since the last yum transaction.

  Installing     : libjpeg-6b-46.fc12.i686                                 1/17

  Installing     : libtiff-3.8.2-15.fc12.i686                              2/17

  Installing     : libdaemon-0.14-1.fc12.i686                              3/17

  Installing     : avahi-0.6.25-5.fc12.i686                                4/17

  Installing     : libtdb-1.1.5-2.fc12.i686                                5/17

  Installing     : 1:pkgconfig-0.23-9.fc12.i686                            6/17

  Installing     : samba-common-3.4.2-47.fc12.i686                         7/17

  Installing     : libtasn1-2.3-1.fc12.i686                                8/17

  Installing     : gnutls-2.8.5-1.fc12.i686                                9/17

  Installing     : 1:cups-libs-1.4.1-13.fc12.i686                         10/17

  Installing     : 1:perl-Module-Pluggable-3.90-82.fc12.i686              11/17

  Installing     : 3:perl-version-0.74-82.fc12.i686                       12/17

  Installing     : 1:perl-Pod-Escapes-1.04-82.fc12.i686                   13/17

  Installing     : 4:perl-libs-5.10.0-82.fc12.i686                        14/17

  Installing     : 4:perl-5.10.0-82.fc12.i686                             15/17

  Installing     : 1:perl-Pod-Simple-3.07-82.fc12.i686                    16/17

  Installing     : samba-3.4.2-47.fc12.i686                               17/17

 

Installed:

  samba.i686 0:3.4.2-47.fc12                                                   

 

Dependency Installed:

  avahi.i686 0:0.6.25-5.fc12                                                    

  cups-libs.i686 1:1.4.1-13.fc12                                               

  gnutls.i686 0:2.8.5-1.fc12                                                   

  libdaemon.i686 0:0.14-1.fc12                                                  

  libjpeg.i686 0:6b-46.fc12                                                    

  libtasn1.i686 0:2.3-1.fc12                                                   

  libtdb.i686 0:1.1.5-2.fc12                                                    

  libtiff.i686 0:3.8.2-15.fc12                                                 

   perl.i686 4:5.10.0-82.fc12                                                   

  perl-Module-Pluggable.i686 1:3.90-82.fc12                                    

  perl-Pod-Escapes.i686 1:1.04-82.fc12                                         

  perl-Pod-Simple.i686 1:3.07-82.fc12                                          

  perl-libs.i686 4:5.10.0-82.fc12                                              

  perl-version.i686 3:0.74-82.fc12                                             

  pkgconfig.i686 1:0.23-9.fc12                                                 

  samba-common.i686 0:3.4.2-47.fc12                                            

 

Complete!

 

如果安装过程中有错误提示,请见下面第5点的处理,处理完后重复第4步骤。

5)      yum安装软件过程中的错误处理

5.1  注意,如果安装过程中有下面信息错误信息提示:

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 signature: NOKEY, key ID 57bbccba

Public key for samba-3.4.2-47.fc12.i686.rpm is not installed

         这是因为没有安装rpm包的签名信息导致,只有安装下签名信息即可:

         [root@localhost Packages]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

 

二、            samba 安装

 

1)           首先检查系统是否安装好了samba

 

[root@localhost mnt]# rpm -qa | grep samba

 

如果出现下面三行内容,则表示已经安装好了Samba

 

samba-winbind-clients-3.4.2-47.fc12.i686

samba-common-3.4.2-47.fc12.i686

samba-3.4.2-47.fc12.i686

 

如果没有安装好,需要挂载安装光盘Fedora-12-i386-DVD.iso

 

[root@localhost /]# mount  –t auto  /dev/cdrom /mnt/

mount: block device /dev/sr0 is write-protected, mounting read-only

[root@localhost /]# cd /mnt/

[root@localhost mnt]# ls

EFI         Packages                       RPM-GPG-KEY-fedora-ppc

GPL         repodata                       RPM-GPG-KEY-fedora-ppc64

images      RPM-GPG-KEY-fedora             RPM-GPG-KEY-fedora-x86_64

isolinux    RPM-GPG-KEY-fedora-12-primary  TRANS.TBL

media.repo  RPM-GPG-KEY-fedora-i386

 

[root@localhost mnt]# cd Packages/

[root@localhost Packages]# rpm -ivh samba-3.4.2-47.fc12.i686.rpm

即可安装成功。

如果不能安装,有依赖关系提示的话,请使用yum安装:

[root@localhost Packages]# yum localinstall samba-3.4.2-47.fc12.i686.rpm

2)           配置smb

 

[root@localhost /]# cd /etc/samba/

[root@localhost samba]# ls

lmhosts  smb.conf  smbpasswd  smbusers

 

这里的smb.confsamba服务器的主要配置文件。

还要注意一点,smbpasswd文件是用来存储用户帐号和经过md5加密后的密码。

刚安装好samba服务时,此文件不存在。需要手工创建。下面会介绍。

 

◆编辑smb.conf文件

 

[root@localhost samba]# vi smb.conf

进行如下设置:

#============================ Share Definitions ==============================

        

[homes]

         comment = Home Directories

         browseable = yes

         writable = yes

;        valid users = %S

;        valid users = MYDOMAIN/%S

 

 

# A publicly accessible directory, but read only, except for people in

# the "staff" group

;        [public]

;        comment = Public Stuff

;        path = /home/dengfei

;        public = yes

;        writable = yes

;        printable = no

;        write list = +staff

 

wq! (保存退出)

 

提示:

path = /home/dengfei /home/dengfei为共享目录

3)           启动smb服务

 

[root@localhost samba]# service smb start

Starting SMB services: [ OK ]

[root@localhost samba]# service nmb start

Starting NMB services: [ OK ]

 

4)           添加smb共享目录的用户

 

1)建一个系统用户

[root@localhost samba]#  useradd testuser (建一个名叫testuser的用户)

[root@localhost samba]#  passwd testuser (给testuser用户添加密码)

Changing password for user samba.

New password: (密码要六位以上,不显示在屏幕上)

BAD PASSWORD: it does not contain enough DIFFERENT characters

Retype new password: (确认密码)

passwd: all authentication tokens updated successfully

 

2) 更新 /etv/samba/smbpasswd 文件

[root@localhost samba]# cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd

 

3) 然后创建samba帐户

[root@localhost samba]# smbpasswd -a testuser

New SMB password:

Retype new SMB password:

Added user testuser.

 

6、重新启动smb服务

 

[root@localhost samba]# service smb restart

Shutting down SMB services: [ OK ]

Starting SMB services: [ OK ]

[root@localhost samba]# service nmb restart

Shutting down NMB services: [ OK ]

Starting NMB services: [ OK ]

 

5)           关闭不必要的服务

1、  打开selinux共享

[root@localhost samba]# setsebool -P samba_enable_home_dirs on

2、  开启samba读写权限

[root@localhost samba]# setsebool -P samba_export_all_rw on

3、  关闭防火墙

[root@localhost samba]# chkconfig iptables off (永久关闭,重启不复原)

[root@localhost samba]# service iptables stop (马上生效,启动后又打开了)

 

6)           测试smb

 

Linux 下访问自己的samba服务器,显示信息为:

如果没有smbclient命令,就先要按照smbclient rpm包。

[root@localhost samba]# smbclient -L //192.168.40.200 -U dengfei

Enter dengfei's password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.4.2-47.fc12]

 

        Sharename       Type      Comment

        ---------       ----      -------

        homes           Disk      Home Directories

        IPC$            IPC       IPC Service (Samba Server Version 3.4.2-47.fc12)

        dengfei         Disk      Home Directories

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.4.2-47.fc12]

 

        Server               Comment

        ---------            -------

        LOCALHOST            Samba Server Version 3.4.2-47.fc12

 

        Workgroup            Master

        ---------            -------

        MYGROUP              LOCALHOST

        WORKGROUP            IPANEL-C4977EBB

 

参考文档:

http://crazytoon.com/2007/05/22/samba-how-do-you-install-and-set-up-samba-in-linux-redhat-enterpriserhel-centos-fedora/ (外国人写的,比较有技术含量)

http://linux.vbird.org/linux_server/0370samba.php(介绍samba的由来及详细资料,可以随便看看)

 

三、            tftp安装

1)           查询tftp软件包是否安装

rpm -qa | grep tftp

如果有显示:

tftp-0.49-5.fc12.i686

tftp-server-0.49-5.fc12.i686

就表示软件包有正确安装。

2)           安装软件包

如果没有任何提示表示没有安装软件包,需要下载tftp-0.49-5.fc12.i686.rpmtftp-server-0.49-5.fc12.i686.rpm,并且下载xinetd-2.3.14-31.fc12.i686.rpm软件包并安装,

安装命令:

rpm -ivh tftp-0.49-5.fc12.i686.rpm

rpm -ivh xinetd-2.3.14-31.fc12.i686.rpm

rpm -ivh tftp-server-0.49-5.fc12.i686.rpm

 

3)           配置tftp

如果有安装软件包,则需要配置tftp服务,运行命令:vi /etc/xinetd.d/tftp 配置成如下格式:

service tftp

{

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot -c

        disable                 = no

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

其中,server_args用于指定tftp的目录,-s指定目录,-c指定了可以创立文件。

如果没有/tftpboot目录,则使用命令:mkdir /tftpboot命令创建这个目录,并使用命令chmod 777 -R /tftpboot命令改变目录权限。

 

 

4)           重启下系统

5)           启动tftp

做好这些后,使用命令:service xinetd restart 启动tftp服务。

 

6)           测试tftp

验证tftp服务是否可以使用,在/tftpboot目录下面放置一个文件test.txt。在命令输入框中cd 跳转到其他目录做如下操作:

[root@localhost home]# cd /home/

[root@localhost home]# tftp 192.168.1.100

tftp> get test.txt

tftp> q

[root@localhost home]# ls

test.txt

如果没有提示,并且在当前目录能看到get的文件,说明tftp安装成功。

7)           tftp 测试出错处理

如果在测试tftp时,出现如下错误:

Error code 0: Permission denied

出现这样的问题是因为selinux造成的,只要修改/etc/sysconfig/selinux中的SELINUX改成SELINUX=disabled,在重启就能解决。

四、            安装nfs服务

1)           安装nfs软件包

1、  查询是否已经安装nfs软件包

rpm –qa | grep nfs

如果有下列显示,则表示已经安装nfs软件包:

[root@localhost home]# rpm -qa | grep nfs

nfs-utils-lib-1.1.4-8.fc12.i686

nfs-utils-1.2.0-18.fc12.i686

 

如果没有安装则使用yum安装,

yum localinstall nfs-utils-1.2.0-18.fc12.i686.rpm

2)           修改nfs目录

修改nfs共享设置:

[root@localhost ~]# vi /etc/exports

/share *(rw,no_root_squash,sync,no_all_squash)

 

wq!保存退出

 

Logo

更多推荐