Linux operation and Maintenance little memory

Source: Internet
Author: User
Tags ftp client iptables

In Linux CentOS operations, common operations and commands are recorded:

1. DNS Settings

On a Linux server, when we ping this error: Ping:unknown host, it is very likely that the system's DNS is not set or set incorrectly. In/etc/resolv.conf, you can set the following:

# cat/etc/resolv.conf   NameServer 8.8.8.8  8.8.4.4  

2. FTP Client Configuration

When we need to connect an FTP on a Linux server, enter the FTP naming prompt for this error:-bash:ftp:command not found, the FTP client may not be installed on the server. We can go to the http://mirror.centos.org/centos/5/os/i386/CentOS/and find the FTP RPM package to install the address after download to perform the installation:

# RPM-UVH http://mirror.centos.org/centos/5/os/i386/CentOS/ftp-0.17-38.el5.i386.rpm

3. Firewall configuration

Linux firewall believe that everyone is not unfamiliar, iptables function is very powerful, we temporarily only list our commonly used, such as the current system only open SSH 22 port,

[[email protected]/] # Cat/etc/sysconfig/iptables # Firewall configuration written by System-config-firewall # Manual Customization of this file are not recommended. *filter: INPUT ACCEPT [0:0]:forward Accept[0:0]:output Accept[0:0]-A Input-i Lo-J Accept-a input-m state--state new-m tcp-p TCP--dport-J Accept-a input-j REJ ECT--reject-with icmp-host-prohibited-A forward-j reject--reject-with icmp-host-prohibited

Let's add another line.

-A input-m state--state new-m tcp-p tcp--dport 8080-J ACCEPT so that access to port 8080 can be released;

-A input-s 192.168.4.6-p TCP--dport 22-j Accept, this allows only the 192.168.0.3 of the machine to SSH connection;

If you want to allow or restrict a certain IP address, you can use 192.168.0.0/24 to represent all IP addresses on the 192.168.0.1-255 side.

After modification, the next iptables needs to be restarted for the configuration to take effect:

[[email protected]/] # Service iptables Restart

4. Nginx Deployment

First download the. tar.gz installation package: http://nginx.org/en/download.html, then unzip to the directory you want:

Nginx-1.8.0.tar.gz

Set up configuration information, compile, install:

./configure--prefix=/home/nginx/nginx/nginx-1.8.0Makemake Install

If the process of editing and installation, there is no error description such as errors, and Nginx root directory generated the Sbin folder, then congratulations, the installation was successful!

My server environment, however, made an error when making the edit:./configure:error:the HTTP Rewrite module requires the PCRE library.

The error is missing the Pcre library because Nginx rewrite relies on the Pcre library, so you need to compile and install the Pcre library in Linux ...

We can go to http://sourceforge.net/projects/pcre/files/pcre/, choose to download a pcre version, unzip, after the usual, configure the installation of the compilation:

Tar zxvf pcre-8.36. tar.gz. /Configuremakemake Install

After the installation is successful, we will then compile and install the Nginx. Well, there's no error warning, the installation was successful. Start Nginx:

cd/home/nginx/nginx-1.8.0/sbin. /nginx

But it went wrong:./nginx:error while loading shared libraries:libpcre.so.1:cannot open Shared object file:no such file or direct Ory

Online check, it is said that because the dynamic link library is not created links, execute the following command:

Ln-s/usr/local/lib/libpcre.so.1/lib     #ln-s/usr/local/lib/libpcre.so.1/lib64   # 

Finally, the./nginx starts again.

Available through Ps-ef | grep nginx View, if there are 2 Nginx process (a master a worker), then Nginx has started normally, open the browser of the machine, Access HTTP./server IP, the friendly screen oncoming!

5. Tomcat Deployment

First download the. tar.gz installation package: http://tomcat.apache.org/download-70.cgi, then unzip to the directory you want:

Tar zxvf apache-tomcat-6.0.44.tar.gz

Environment variables I don't deserve it.

Start tomcat into the bin directory of Tomcat:

To the Tomcat bin directory, close tomcat:

./shutdown.sh Stop

Linux operation and Maintenance little memory

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.