Mysql for two-way Database Synchronization in linux

Source: Internet
Author: User
Tags fully qualified domain name
Environment: Build a blog under lamp and implement synchronization here: Taking wordpress as an example, the specific operations are as follows: 1. Environment configuration 1. automatically obtain the IP address, and set the virtual machine to bridge 2. [root @ gjpslave ~] # Yumi

Environment: Build a blog under lamp and implement synchronization here: Taking wordpress as an example, the specific operations are as follows: 1. Environment configuration 1. automatically obtain the IP address, and set the virtual machine to bridge 2. [root @ gjpslave ~] # Yumi

Environment: Build a blog under lamp and implement synchronization

Here: wordpress is used as an example for implementation.

The procedure is as follows:

I. Environment Configuration

1. automatically obtain the IP address, and set the virtual machine to bridge

2. [root @ gjpslave ~] # Yum install wget

# Replace it with 163 yum Source:

Cd/etc/yum. repos. d

Mv CentOS-Base.repo CentOS-Base.repo.save

Wget mirrors.163.com/.help/CentOS5-Base-163.repo

# Wget mirrors.163.com/.help/CentOS6-Base-163.repo

Sed-I's/enabled = 1/enabled = 0/G'/etc/yum/pluginconf. d/fastestmirror. conf

Cat/dev/null>/var/cache/yum/timedhosts.txt

Yum clean all

Yum makecache

3. yum-y install gcc * gcc-c ++ rpm-build mysql * httpd * php * ppp openldap-devel lrzsz pam-devel wget net-snmp * ntp openssl * libgssapi * iptraf libtool -ltdl * libtool crontabs libpcap * flex byacc libpcap ncurses-devel automake autoconf libtool make traceroute wget scp openssh * setuptool mlocate pam. i686 openssl. i686 libgcrypt. i686 openssl098e. i686 glibc. i686 fping nload iftop iperf chkconfig unrar -- skip-broken

Yum-y update

4. System Security

Specify a domain name for the new server on dnspod.cn

Hostname xx name Host Name

#### Security ###

Arp-a | grep $ (/sbin/route-n | awk '$1 = "0.0.0.0" {print $2 }') | awk '{print $2 "" $4}' | sed's # (# G' | sed's #) # G'>/etc/ethers & arp-f

Echo "SELINUX = disabled">/etc/sysconfig/selinux

Echo "SELINUXTYPE = targeted">/etc/sysconfig/selinux

Setenforce 0

Echo "HISTSIZE = 5">/root/. bash_profile

Chkconfig -- level 2345 maid off

Chkconfig -- level 2345 rpcidmapd off

Chkconfig -- level 2345 cups off

Chkconfig -- level 2345 portmap off

Chkconfig -- level 2345 yum-updatesd off

Chkconfig -- level 2345 iptables off

Chkconfig -- level 2345 sendmail off

Killall cupsd portmap rpc. statd

Service iptables stop

Service yum-updatesd stop

Service sendmail stop

Echo "Port 2121">/etc/ssh/sshd_config

Echo "ClientAliveInterval 9999">/etc/ssh/sshd_config

Service sshd restart

2. Build wordpress through a blog

Wget

Tar zxvf

[Root @ gjpmaster tmp] # ls

Hsperfdata_root wordpress wordpress-3.9-zh_CN.tar.gz yum. log yum_save_tx-2013-08

[Root @ gjpmaster tmp] # cp-a wordpress/*/var/www/html/

[Root @ gjpmaster ~] # Useradd-d/var/www/html/-s/sbin/nologin gjpmaster

Useradd: warning: the home directory already exists.

Not copying any file from skel directory into it.

[Root @ gjpmaster ~] # Passwd gjpmaster

Changing password for user gjpmaster.

New password: 123456

Bad password: it is too simplistic/systematic

Bad password: is too simple

Retype new password:

Passwd: all authentication tokens updated successfully.

Mysql> create database gjpmaster;

Query OK, 1 row affected (0.04 sec)

Mysql> grant all on gjpmaster. * to gjpmaster @ localhost identified by "gjpmaster321 ";

Query OK, 0 rows affected (0.00 sec)

[Root @ gjpmaster ~] # Mysql-u gjpmaster-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or \ g.

Your MySQL connection id is 4

Server version: 5.1.73 Source distribution

Copyright (c) 2000,201 3, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> quit

Bye

[Root @ gjpmaster html] # cp-a wp-config-sample.php wp-config.php

[Root @ gjpmaster html] # vi wp-config.php

[Root @ gjpmaster html] # chmod 777-R wp-content/

[Root @ gjpmaster html] # vim/etc/httpd/conf/httpd. conf

Options-Indexes

RewriteEngine on

RewriteBase/

RewriteCond % {REQUEST_FILENAME }! -F

RewriteCond % {REQUEST_FILENAME }! -D

RewriteRule ^ (. *) $ index. php? Q = $1 [L, QSA]

[Root @ gjpmaster html] # service httpd restart

Stopping httpd: [OK]

Starting httpd: apr_sockaddr_info_get () failed for gjpmaster

Httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

[OK]

Unable to enter the front-end:

[Root @ gjpmaster html] # vim wp-nodes des/template-loader.php

3. ftp is used to upload and download content to a blog

# Installation
Yum-y install vsftpd
# Modifying the configuration file
Vi/etc/vsftpd. conf

# System

Local_umask = 022

Pasv_enable = YES

Connect_from_port_20 = YES

Local_enable = YES

Write_enable = YES

Use_localtime = YES

Listen = YES

Listen_port = 21

# Security

Guest_enable = NO

Pam_service_name = vsftpd

Tcp_wrappers = YES

Userlist_enable = YES

Userlist_deny = NO

Userlist_file =/etc/vsftpd/user_list

Chroot_local_user = YES

# Chroot_list_enable = YES

# Chroot_list_file =/etc/vsftpd. chroot_list

# Log

Xferlog_enable = YES

Xferlog_std_format = YES

Xferlog_file =/var/log/vsftpd. log

# Anonymous

Anonymous_enable = NO

# Max_per_ip = 13

# Max_clients = 50

# Anon_world_readable_only = YES

# Anon_other_write_enable = NO

# Anon_mkdir_write_enable = NO

# Anon_upload_enable = NO

No_anon_password = YES

# Anon_max_rates = 200000

# Start ftp

Service vsftpd restart

# Allow Anonymous login

The following two configuration files must be modified:

No_anon_password = YES

Anonymous_enable = YES

Add anonymous to/etc/vsftpd/user_list

# Adding users

In either case, a specified directory is assigned to the specified user. For example,/var/ftp is assigned to the user wow. Second, the user directory is directly set up as/home/user name.

1. For example, assign/var/ftp to wow.

Useradd-s/sbin/nologin-d/var/ftp wow // sbin/nologin is a security configuration, which means that this user cannot log on via ssh only after login via ftp-d is the directory specified for this user

Passwd wow // modify the wow User Name

Echo wow>/etc/vsftpd/user_list must be used here> otherwise, the original user names stored in the table will be cleared. Only the user names in the user_list list can log on to ftp to upload files. Therefore, each time you add one all user names must be written to this file.

2. You can create a test user to upload or download files by yourself.

Usreadd-s/sbin/nologin test

Passwd test

Echo test>/etc/vsftpd/user_list

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.