How to install samba in linux and precautions

Source: Internet
Author: User

How to install samba in linux and precautions

There are many ways to install software in linux: 1. Directly install (rpm-ivh package) with an rpm package; 2. Install yum; 3. apt-get.

If you can connect to the Internet, apt-get is the simplest method. But what if I cannot connect to the Internet?

If method 1 is used for installation, You need to download the required packages and their dependent packages. if the version does not match, you need to constantly verify the corresponding feasible version, which is complicated and complicated. Therefore, this solution is not recommended.

Therefore, yum is used for installation.

If you use yum for installation, you also need a reliable source. You can create a myyum. repo file in/etc/yum. repos. d/and write the following text:

[myyum]name=Red Hatbaseurl=http://192.168.0.10/isoenabled=0gpgcheck=0
If the required installation package exists in the source, you can directly install it using yum install XXX. Otherwise, refer to the http://blog.csdn.net/hshl1214/article/details/6188154

I. Experiment on two computers

1: Server RedHat Enterprise 5

Ip: 192.168.1.112

2: client RedHat Enterprise 5

Ip: 192.168.1.113

3: servers and clients can ping each other

Ii. Server Configuration:

1: Create the directory networkyum for storing the DVD Disc package under the/home/directory.

Run mkdir-p/home/networkyum

2: mount the DVD drive to/mnt/

Run the command: mount/dev/hdc/mnt/

3: Copy all files and subdirectories under v/mnt/Server/to/home/networkyum /.

Run the command cp/mnt/Server/*. */home/networkyum/

4: Install the rpm package createrepo

Run the command: rpm-ivh createrepo ...... ... . I386.rpm

5. Install the yum database file and information index file.

Run the following command: createrepo-g/home/networkyum/Server/repodata/compsrhel5-

Server-core.xml/home/networkyum/Serve

Iii. Client Configuration:

1: connect to the YUM repository of the server and create the file extension. repo in the/etc/yum. repos. d/directory.

File Name

Run the command: touch/etc/yum. repos. d/ftpyum. repo

2. Modify the ftpyum. repo file.

Run the command: vi/etc/yum. repos. d/ftpyum. repo

3: configuration file ftpyum. repo content:

[Server-ftp]

Name = Server-ftp

Baseurl = ftp: // 192.168.1.112/home/networkyum/Server

Enabled = 1

Gpgcheck = 0

4: Clear cache and refresh list

Run the command: yum clean all

Run the command: yum list

5: Test

Run the command: yum install dhcp

6: Completed Successfully

The following is how samba configures Shared Folders:

Installation Guide

Document version 01 (2007-04-01) 1
For samba shared folders in Linux (centos 5.6), follow the Configuration Guide.

Step 1 # yum-y install samba
Use the yum command to install samba and add the-y parameter. If you are asked to automatically select y, automatically download and install samba. This process takes some time.
Step 2 # rpm-qa | grep samba
Check the installation of the samba service package to display files like the following: samba-common-3.0.33-3.7.el5_3.1 // files required by both the server and client samba-3.0.33-3.7.el5_3.1 // server files
Step 3 # whereis samba
For yum installation, you can use this command to view the samba installation location and obtain the following content: samba: /etc/samba/usr/lib/samba/usr/share/man/man7/samba.7.gz
Step 4. Change the smb. conf file.
For example, you need to implement the simplest function so that all users can read and write a folder shared by a Samba server. 1.
Back up the smb. conf file.
# Cd/etc/samba
# Mv smb. conf smb. confBAK
2. Create a New smb. conf file.
# Touch smb. conf
3.
Add the following configuration items in smb. conf. The configuration items of related commands are described in Table 1-1.
[Global]
Workgroup = LinuxSir netbios name = LinuxSir05
Server string = Linux Samba Server TestServer security = share [linuxsir]
Path =/opt/linuxsir writeable = yes browseable = yes guest OK = yes oplocks = no
Table 1-1 smb. conf
Configuration item
Description
[Global] is a global configuration and must be added. Workgroup
Indicates the working group displayed in Windows. For example, set it to LinuxSir in this example.

Wk_ad_begin ({pid: 21}); wk_ad_after (21, function () {$ ('. ad-den '). hide () ;}, function () {$ ('. ad-den '). show ();});

Installation Guide

Configuration item description
Netbios name the computer name displayed in Windows. Server string Samba server description, which can be customized. Security
Authentication and logon methods. There are two methods:
Administrative user
You must set the user name and password. Shareshare
You do not need to set the user name and password.
For example, share is used in this example.
[Linuxsir] the shared directory is displayed in Windows. Path: Specifies the storage path of the directory to be shared. Whether writeable can be written. For example, set writeable in this example. Whether browseable can be viewed.
Guest OK
An anonymous user logs on as a guest user.
Modify the password according to the requirements of the local authority and add an account. You cannot use the guest account to log on.
Oplocks = no
Close the file lock status. The process can access the same file in parallel.
Note:
If this parameter is not set to "no", when a process accesses a file, the file is marked as locked. At this time, other processes will not be able to access the file, causing the process to crash and may cause downtime.

Step 5 create a directory and authorize it.
# Mkdir-p/opt/linuxsir # id nobody
Uid = 99 (nobody) gid = 99 (nobody) groups = 99 (nobody) # chown-R nobody: nobody/opt/linuxsir
Step 6 start the smbd and nmbd servers. (Centos samba startup:/etc/init. d/samba restart)
# Smbd # nmbd
Step 7 check the smbd process and check whether the Samba service is running;
# Pgrep smbd 13564 13568
Step 8. Start the Samba service.
[Root @ sample ~] # Chkconfig smb on startup
[Root @ sample ~] # Chkconfig -- list smb restart confirm the Samba startup tag, and confirm that 2-5 is
On Status
Smb 0: off 1: off 2: on 3: on 4: on 5: on 6: off
[Root @ sample ~] #/Etc/rc. d/init. d/smb start transaction start Samba service Starting SMB services: [OK] Starting NMB services: [OK]
Step 9 access Samba server sharing.
Bytes
In Linux, you can use the following command to access.
# Smbclient-L // LinuxSir05
Password: // press Enter directly"
Bytes
In Windows, you can use the following methods.
// LinuxSir05/
Step 10 mount the samba Service
Bytes
Mount shared directory
Mount-o username = www, password = www // 192.168.0.61/samba_file/data0/htdocs/apps/Public/upload
Mount-o username = user name, password = password,-l // ip address or computer name/Shared Folder name mount point, example:
Bytes
Use the root user to edit vi/etc/fstab and add the following to the end:
// 192.168.0.246/share/data0/htdocs/apps/img defaults, auto, username = www, password = www 0 0
In this way, linux instances can be automatically mounted to the shared directory after restart.
References:
CentOS Samba Server Configuration:
Http://liumin20081128.blog.163.com/blog/static/601960692008922103010157/ http://hi.baidu.com/dmr88/blog/item/710164c3556e8c59b319a8c0.html samba service mount Method:
Http://www.sudu.cn/info/html/edu/20060101/298331.html
Because yum installation can use this command to start samba, if you want to start the samba service yourself, please refer to this article http://hi.baidu.com/linglongwunv/blog/item/be4009c5dda5eda08326ac21.html
8. If the startup is successful, the easiest samba suitable for intranet use has been configured. Uninstall samba refer to this article http://hi.baidu.com/linglongwunv/blog/item/3770cff4266c742cbc310993.html
9. Connect to the Samba server from a Windows client, that is, the client can refer to this article http://hi.baidu.com/linglongwunv/blog/item/9f1c348924387d9da4c27208.html by using samba Methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.