Methods and considerations for installing Samba in Linux

Source: Internet
Author: User

There are many ways to install software in Linux: 1. Install (RPM-IVH package) directly with RPM packages, 2.yum installation, 3.apt-get, etc.

Using Apt-get is the simplest way to connect to the Internet. But what if we can't connect to the Internet?

If you install using Method 1, you need to download and install the required packages and their dependent packages, and if the version does not match, you also need to constantly verify that the appropriate version of the more complicated, so it is not recommended to use this scenario.

As a result, Yum is installed here.


With Yum installation, you also need a reliable source to create a new 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 there is a need to install the package in the source, you can install it directly with yum install XXX. Otherwise, refer to http://blog.csdn.net/hshl1214/article/details/6188154

One: Two computers to do the experiment

1: Server Redhat Enterprise 5

ip:192.168.1.112

2: Client Redhat Enterprise 5

ip:192.168.1.113

3: Server and client can ping each other

Second: The server configuration is as follows

1: Create the directory of the package that holds the DVD disc in the/home/directory Networkyum

Execute command: Mkdir–p/home/networkyum

2: Mount DVD drive to/mnt/

Execute command: mount/dev/hdc/mnt/

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

Execute command: Cp/mnt/server/*.*/home/networkyum/

4: Install RPM package Createrepo

Execute command: Rpm–ivh createrepo .... i386.rpm

5: Install Yum database file and information index file

Execute command: Createrepo-g/home/networkyum/server/repodata/compsrhel5-

Server-core.xml/home/networkyum/serve

Three: The client configuration is as follows

1: Connect server to the Yum repository, in the/etc/yum.repos.d/directory, build the extension. Repo

The file name

Execute command: Touch/etc/yum.repos.d/ftpyum.repo

2: Modify File Ftpyum.repo

Execute command: Vi/etc/yum.repos.d/ftpyum.repo

3: The contents of the configuration file Ftpyum.repo:

[Server-ftp]

Name=server-ftp

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

Enabled=1

Gpgcheck=0

4: Clear Cache and Refresh list

Execute command: Yum clean all

Execute command: Yum list

5: Test

Execute command: Yum install DHCP

6: Successful completion


Here's how Samba configures shared folders:

Installation Guide

Document Version 01 (2007-04-01) 1
Linux (CentOS 5.6) under Samba shared folders follow the configuration guide

Step 1 # yum-y Install Samba
Use the Yum command to install Samba, add the-y parameter, and automatically download and install Samba when asked to auto-select Y, which takes a while.
Step 2 # Rpm-qa | grep Samba
Checking the installation of the Samba Service pack will show two packages similar to the following: samba-common-3.0.33-3.7.el5_3.1//files required by server and client samba-3.0.33-3.7.el5_3.1// Server-side files
Step 3 # Whereis Samba
Because it is a Yum installation, you can use this command to view the Samba installation location and get something similar to the following: Samba:/etc/samba/usr/lib/samba/usr/share/samba/usr/share/man/man7/ Samba.7.gz
Step 4 Change the smb.conf file.
For example, you need to implement one of the simplest features that allows all users to read and write to a folder shared by a Samba server. 1.
Back up the smb.conf file.
# Cd/etc/samba
# MV Smb.conf Smb.confbak
2. Re-create a smb.conf file.
#touch smb.conf
3.
Add the following configuration items in smb.conf. The configuration item description for the related command is shown 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 File Add Item description
Configuration Items
Description
[Global] This is a global configuration and is required to be added. Workgroup
Represents a workgroup that is displayed in Windows, for example, set to Linuxsir in this example.




Wk_ad_begin ({pid:21}); Wk_ad_after (, function () {$ ('. Ad-hidden '). Hide ();}, function () {$ ('. Ad-hidden '). Show ();});






Installation Guide


Configuration Item Description
NetBIOS name Displays the computer name in Windows. Server string Samba server description, which can be defined by itself. Security
Authentication and Logon methods. There are two ways of doing this:
user
mode, you need to set the user name and password. share
, you do not need to set the user name and password.
For example, the share method is used in this example.
[Linuxsir] This is a shared directory that is displayed in Windows. Path sets the storage path for the directory to be shared. Whether the writeable is writable, for example, is set to writable in this example. Whether the browseable can be browsed.
Guest OK
Anonymous users are logged on as guest.
Please update the account according to the requirements of the Bureau, you can not log in with the Guest account.
Oplocks=no
The locked state of the file is closed, and the process can access the same file in parallel.
Attention:
If the parameter is not set to "no", when a process accesses a file, the file is marked as locked. At this point, other processes are unable to access the file, causing the process to hang dead, which could lead to downtime.

Step 5 Establish the appropriate directory and authorize.
# 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 boot:/etc/init.d/samba restart)
# smbd # NMBD
Step 7 Review the SMBD process to see if the Samba service is running;
# pgrep SMBD 13564 13568
Step 8 Finally, start the Samba service.
[[email protected] ~]# chkconfig SMB on← set Samba self-boot
[[email protected] ~]# chkconfig--list smb← confirm Samba boot tag, confirm 2-5 for
On state
SMB 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[email protected] ~]#/ETC/RC.D/INIT.D/SMB start← start Samba Service starting SMB services: [OK] Starting NMB Services : [OK]
Step 9 access the share of the samba server.

In Linux you can use the following command to access it.
# smbclient-l//linuxsir05
Password://Press "Enter" directly

In Windows, you can access it in the following ways.
linuxsir05/
Step Ten Samba Service Mount method

Mount 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, case as above

With the root user, edit the Vi/etc/fstab, and on the last side add:
192.168.0.246/share/data0/htdocs/apps/img defaults,auto,username=www,password=www 0 0
This allows the Linux machine reboot to be automatically mounted to the shared directory.
Resources:
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
Since it is a Yum installation to start Samba with this command, please refer to this article if you want to boot the Samba service from http://hi.baidu.com/linglongwunv/blog/item/be4009c5dda5eda08326ac21.html
8, if the start is successful, the simplest suitable for intranet use of Samba has been configured. To uninstall Samba Please refer to this article http://hi.baidu.com/linglongwunv/blog/item/3770cff4266c742cbc310993.html
9. Connect to a Samba server from a Windows client, which is how clients use Samba to refer to this article http://hi.baidu.com/linglongwunv/blog/item/9f1c348924387d9da4c27208.html


Methods and considerations for installing Samba in Linux

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.