Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use CentOS to build File Server Samba

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use CentOS to build file server Samba, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

However, according to the latest data from foreign technology website w3techs, as of July 28, 2010, CentOS occupied the top spot of Linux Web server with a share of 31.6%, followed by Debian and Red Hat respectively. In other words, out of every ten Linux-based Web servers, there are three CentOS, two and a half Debian and one and a half RHEL.

Market share of Linux Web servers from October 2009 to July 2010 (W3Techs statistics)

Although CentOS is not a popular Linux distribution and does not rank particularly well in the ranking of various popular Linux distributions, CentOS is also a distribution with no personality at all-it is exactly the same as Red Hat enterprise Linux. Even so, in Linux running as a Web server, CentOS is No. 1 without suspense

Why is CentOS so useful?

First of all, it should be the reason of "Cost". Since the CentOS distribution is almost identical to the Red Hat enterprise Linux, why not free CentOS without special needs? Moreover, in the United States, the price of RedHat is about $1000 per server per year, while in domestic, large-scale enterprises, the price is between tens of thousands or even hundreds of thousands of yuan per server per year, not everyone is willing to bear this cost.

Second, because CentOS performs very well in terms of performance and functionality. Much like RedHat, CentOS is popular in data centers because it is easy to set up and later maintain and manage. CentOS is a community-maintained operating system, and even many novel features will be tried out on this system first, and only when it matures will it choose to embed its paid enterprise operating system.

The following editor will install this operating system and use it to build a commonly used file server.

CentOS 5.5 Desktop

Page 2: graphical installation process (1)

Graphical installation process (1)

The installation interface of CentOS is divided into two types: graphic mode and text mode. Here, many people will choose text installation mode and command mode to control the system, which can save a lot of resources for the system. Here the editor is specially here to experience the graphical mode installation. Click the enter key to start the installation.

Installation initial interface

Then, you can choose CD-ROM installation or hard disk installation to enter the graphical installation interface.

The following steps are the same as other system installation procedures: select the system language, keyboard layout, create partitions, network devices, clocks, and usernames and passwords. Of course, you can set it manually, configure the hostname and other settings on the "network device". Here, the editor chooses that the system will be configured through VI after the installation is complete.

Network equipment

When the system configuration is complete, click "next" to begin the installation of CentOS 5.5

Page 3: graphical installation process (2)

Graphical installation process (2)

After the system installation is complete, a reboot is required. After that, there are several basic settings for the system.

Welcome interface

Confirm whether the firewall is enabled and select the trusted service

SELinux Settin

At the same time, the system requires you to proofread the current time and set the user and password. Since then, the installation of the system has been completed.

Page 4: install Samba

Install Samba

After completing the installation of the CentOS 5.5 system, the following begins today's main task: building a file server through a Samba server.

When we use Windows as a client, there is usually a need for file and print sharing. As one of the Windows network functions, these requirements can usually be achieved between Windows clients through the inherent capabilities of Windows Network. However, through Samba, we can also make a CentOS host and Windows network, achieve the same function, and then give full play to the availability of CentOS hosts.

Note: Samba is a suite of tools, a free software that implements the SMB (Server Message Block) protocol on Linux and UNIX systems, and consists of server and client programs.

First, install Samba online through yum.

Note: Yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora and RedHat as well as in SUSE. Based on RPM package management, RPM packages can be downloaded and installed automatically from designated servers, dependencies can be automatically dealt with, and all dependent software packages can be installed at one time without tedious downloading and installation.

Install Samba online

Because it is an online installation, it usually takes some time to complete the installation, and the system will be constantly prompted.

Samba installed successfully

Page 5: configure Samba (1)

Configure Samba

After the installation is complete, the Samba is also configured as required by editing / etc/samba/smb.conf. Here, the intention of this article is to apply file sharing only to the intranet, and to make the directory to be shared have sufficient read and write permissions.

Locate the global setting label [global] and add the parameter settings for the text encoding under it.

Edit Samba's configuration file smb.conf

At the same time, find the line workgroup = MYGROUP, and change the workgroup name to the workgroup name WORKGROUP defined by the Windows network. And set hosts allow = 192.168.0.127, specify the private network IP address and local, only allow access in these two cases, and cancel the ";" symbol before the line.

Modify workgroup name and host to allow IP

Then define the public shared directory by filling in the following lines at the end of the configuration file:

Define a public shared directory

Page 6: configure Samba (2)

Configure Samba

Next, create a private directory that will be shared to the Windows network through Samba.

A private directory shared with the Windows network through Samba

Before making a connection to the server, the user used to log in to the Samba needs to be set up in advance.

Here, the editor uses the Samba user database management tool "smbpasswd" in CentOS as an example to create user data for logging in to Samba. Of course, the user's information in the Samba user database can be created only if the user exists in the system user. Therefore, you must first create the user with useradd.

Create a new user

Add this user information to the Samba user database

Page 7: start the Samba service

Start the Samba service

Before starting the Samba service, first open the port used by Samba in the firewall settings.

Edit the iptables configuration file through vi / etc/sysconfig/iptables.

Edit iptables profile

Also, type etc/rc.d/init.d/iptables restart to restart iptables for the new rule to take effect. At the same time, start Samba services, including SMB and NMB services.

Restart iptables for the new rules to take effect

Connect to the Samba server from the Windows client

After starting the Samba service on the server side, we can connect to the Samba through the Windows network from the Windows client. Take Windows XP as an example to illustrate the following connection process:

1. Open "Network neighbors" from your desktop, and click the "View workgroup computers" option.

2. Confirm that the connection on the Samba server appears, and double-click it. (the hostname of the document on this site takes Sample as an example)

3. Enter the user name and password of the Samba user set in advance on the server side; (the user name is the same as the system user name, and the password needs to be entered in the Samba special password set for the system user through smbpasswd. )

4. Then confirm that you can connect to the Samba server, and the root directory and Samba private shared directory appear.

Finally, create, modify and delete files in the corresponding directory to test the maneuverability of the corresponding permissions.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report