Linux BASICS (6) and linux Basics

Source: Internet
Author: User

Linux BASICS (6) and linux Basics

I. Samba Service

The Samba service is mainly used to share files with Windows users on Linux servers.

Perform the following five steps to configure the server:

1. Prepare the environment

1) disable the firewall systemctl stop firewalld

2) temporarily disable selinux sentenforce 0

Or disable selinux permanently in the configuration file.

Vim/etc/sysconfig/selinux = disabled

2. Configure the IP address

Make sure the current ip address is available; otherwise, reconfigure an available IP address.

3. install the software package

1) install yum install samba in binary mode

2) source code Installation

A) download the source code package from the official website

B) after installing the lrzsz tool, you can drag the downloaded compressed package to Linux.

Decompress, tar xvf compressed package name

C) install the gcc and glibc compilation tools yum install gcc-* glibc-*-y

D) cd to the installation and decompression directory, configure,./configure -- prefix =/usr/local/samba

E) Compile make

F) execute make install

3) modify the configuration file

The configuration file is in/etc/samba. conf.

We create a new hard disk to store shared files and mount them to/share.

Vim/etc/samba. conf

[Public] # The first line is the user name, the client uses this to identify/path =/share comment = Public Stuff path =/share # share file path public = yes writable = yes # change to yes, otherwise, you do not have the write permission printable = no write list = + staff # You can select which users have the write permission. The default value is all users -- insert --

Do not forget to restart the service after saving AND EXITING

4) start the service

A) For binary installation, start the Samba service with systemctl start smb

Disable the service by using systemctl stop smb.

The restart is systemcrl restart smb.

B) Use/usr/local/samba/bin/samba-c/usr/local/samba/conf/samba. conf to install the source code.

Disable/usr/local/samba/bin/samba-s/usr/local/samba/conf/samba. conf for the service.

Restart/usr/local/samba/bin/samba-s reload

5) test

Create a system user, such as useradd zhangcan

Add password, smbpasswd-a zhangcan

On Windows computer, find "ing network drive" --> enter the ing folder, for example \ 192.168.0.111 \ zhangcan.

Then a login interface will pop out, and you can log on with the System user and password you just created.

Ii. Nginx Service

1. nginx is a high-performance HTTP and reverse proxy server that can handle high-concurrency access and can also be used for load balancing.

The process of configuring Nginx is the same as that of configuring the Samba service. Note that you must install epel-release before installing Nginx. This is an extended package.

View the command containing the nginx process: ps aux | grep nginx

Use kill-9 uid to kill a process

After starting the nginx service, you can enter the local IP address in the address bar of the browser to access the welcome interface of nginx.

The welcome page contains files in/usr/local/nginx/html.

2. Use nginx to Simulate Load Balancing

1) enable four virtual machines, install the nginx service respectively, and obtain IP addresses. One of them serves as the proxy server and the other three as the web server.

2) modify the configuration file of the proxy server, vim/usr/local/nginx/conf/nginx. conf.

Modify two places

Http {include mime. types; default_type application/octet-stream; upstream nginx_webs {# The name after upstream must be the same as the name in the following location server 192.168.16.140; # these three lines are the IP address of the proxy server, if the port is left blank, the default value is 80 server 192.168.16.71; # You can add a weight after the address, for example, weight = 3 server 192.168.16.182 ;}
 location / {                        proxy_pass http://nginx_webs;                            }

You can modify the/usr/local/nginx/html/index.html file on the web server. For example, you can change the file to 1, 2, and 3 respectively, and then you can see the effect in the browser. The number is changed every time you refresh it, it proves that the browser has allocated the access request to the three web servers.

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.