【2018年6月24日 22:55:47】
VM7+CentOS5.5使用NAT方式连接互联网
1、在VMWare的菜单:“VM→Setting...”

2、在VMWare的菜单:“Edit→Virtual Network Edit...”,在弹出的对话框中单击“Restore default”。并且将“Subnet IP”设置成为:"192.168.126.0"(这个IP可以自定义),

再单击“NAt Settings...”

在CentOS:
查看IP地址:

 # ip addr show

·修改网卡设置:

 # vim /etc/sysconfig/network-scripts/ifcfg-eth0

修改内容(192.168.126.x:x取值0~255):

IPADDR=192.168.126.18

重启网卡:service network restart。此时就可以使用XShell连接Linux了。

ping路由

 # ping 192.168.126.1
# ping 192.168.126.2

添加网关:

 # vim /etc/sysconfig/network-scripts/route-eth0

内容如下:

0.0.0.0/0 via 192.168.126.2 dev eth0

重启网卡:

 # service network restart

设置DNS:

 # vim /etc/resolv.conf

内容如下:

nameserver 192.168.126.2
#nameserver 175.188.160.154
#meserver 175.188.160.254
#search localdomain

此时,就可ping同外网了。ping www.baidu.com。

【2018年6月30日 09:45:50】

查看IP地址:ip addr show

 [root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:1d:8f:97 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:33:18:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:33:18:72 brd ff:ff:ff:ff:ff:ff

“2:”的是网卡
如果是CentOS7,修改网卡设置如下:

 vim /etc/sysconfig/network-scripts/ifcfg-ens33

需要修改内容如下,将“BOOTPROTO=dhcp”改为:“BOOTPROTO=static”、“ONBOOT=no”改为:“ONBOOT=yes”,其他三项直接添加。

BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.126.28
NETMASK=225.225.225.0
GATEWAY=192.168.126.2

此时,重启网卡(service network restart)可以用XShell连接Linux了。再将DNS设置与CentOS6一样

 vi /etc/resolv.conf

添加:nameserver 192.168.126.2

 # Generated by NetworkManager
nameserver 192.168.126.2

wq保存退出。此时就可以ping通了。

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=128 time=43.8 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=128 time=27.9 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=3 ttl=128 time=40.5 ms
^C
--- www.a.shifen.com ping statistics ---
15 packets transmitted, 15 received, 0% packet loss, time 14036ms
rtt min/avg/max/mdev = 25.443/35.052/43.864/5.365 ms

如果无法ping通百度,请关闭关闭selinux和防火墙:

 # vi /etc/selinux/config

内容如下:

 # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

将“SELINUX=enforcing”改为“SELINUX=disabled”重启后永久关闭selinux。

# 查看selinux的状态
# sestatus -v
# 这个命令可以临时关闭selinux
# setenforce 0

关闭防火墙:

# 这个命令可以临时关闭防火墙
# service iptables stop
# service ip6tables stop
# 这个命令可以永久关闭防火墙
# chkconfig iptables off
# chkconfig ip6tables off
# 这个命令可以查看防火墙的状态
# chkconfig iptables --list
# chkconfig ip6tables --list

下面是具体过程:

 [root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:27:db:e0 brd ff:ff:ff:ff:ff:ff
inet 192.168.126.18/24 brd 222.190.30.255 scope global eth0
inet6 fe80::20c:29ff:fe27:dbe0/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
[root@localhost ~]# ping 192.168.126.1
PING 192.168.126.1 (192.168.126.1) 56(84) bytes of data.
64 bytes from 192.168.126.1: icmp_seq=1 ttl=64 time=0.369 ms
64 bytes from 192.168.126.1: icmp_seq=2 ttl=64 time=0.612 ms --- 192.168.126.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.369/0.490/0.612/0.123 ms
[root@localhost ~]# ping 192.168.126.2
PING 192.168.126.2 (192.168.126.2) 56(84) bytes of data.
64 bytes from 192.168.126.2: icmp_seq=1 ttl=128 time=0.437 ms
64 bytes from 192.168.126.2: icmp_seq=2 ttl=128 time=0.578 ms --- 192.168.126.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.437/0.507/0.578/0.074 ms
[root@localhost ~]# vim /etc/sysconfig/network-scripts/route-eth0
[root@localhost ~]# service network restart
[root@localhost ~]# ip route show
192.168.126.0/24 dev eth0 proto kernel scope link src 192.168.126.18
169.254.0.0/16 dev eth0 scope link
default via 192.168.126.2 dev eth0
[root@localhost ~]# vim /etc/resolv.conf

具体原理分析:

检测是否可以ping通外网:ping www.baidu.com -c 10 | awk '{ print $0"\t" strftime("%Y-%m-%d %H:%M:%S",systime())}'

 [root@localhost java]# ping www.baidu.com -c 10 | awk '{ print $0"\t" strftime("%Y-%m-%d %H:%M:%S",systime())}'
PING www.a.shifen.com (119.75.213.61) 56(84) bytes of data. 2018-06-25 16:51:49
64 bytes from 127.0.0.1 (119.75.213.61): icmp_seq=1 ttl=128 time=9.37 ms 2018-06-25 16:51:49
64 bytes from 127.0.0.1 (119.75.213.61): icmp_seq=2 ttl=128 time=7.96 ms 2018-06-25 16:51:50
64 bytes from 127.0.0.1 (119.75.213.61): icmp_seq=3 ttl=128 time=8.57 ms 2018-06-25 16:51:51
64 bytes from 127.0.0.1 (119.75.213.61): icmp_seq=4 ttl=128 time=10.8 ms 2018-06-25 16:51:52

Java的jdk的安装(rpm方式):

 [root@localhost ~]# mkdir /usr/local/src/java
[root@localhost ~]# cd /usr/local/src/java
[root@localhost java]# rpm -ivh jdk-8u151-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk1.8 ########################################### [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@localhost java]# java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

安装tomcat

 [root@localhost ~]# mkdir /usr/local/tomcat
[root@localhost ~]cd /usr/local/tomcat
[root@localhost tomcat]tar -zxvf apache-tomcat-8.5.9.tar.gz
[root@localhost tomcat]cd apache-tomcat-8.5.9/bin
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.9
Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.9
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.9/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.5.9/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.5.9/bin/tomcat-juli.jar
Tomcat started.

升级yum:

 # 只升级所有包,不升级软件和系统内核
[root@localhost ~]# yum -y upgrade
# 升级所有包同时也升级软件和系统内核
[root@localhost ~]# yum -y update

在线安装vim:

 # yum -y install vim

具体安装过程:

[root@localhost ~]# yum search vim
Loaded plugins: fastestmirror
http://ftp.sjtu.edu.cn/centos/6.9/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2001:da8:8000:6023::230: Network is unreachable"
Trying other mirror.
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras&infra=stock: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
Error: Cannot retrieve repository metadata (repomd.xml) for repository: extras. Please verify its path and try again
[root@localhost ~]# yum -y install vim
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
extras | 3.4 kB 00:00
extras/primary_db | 30 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 8.1 MB 00:12
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-5.el6_8.1 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-5.el6_8.1 for package: 2:vim-enhanced-7.4.629-5.el6_8.1.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-5.el6_8.1.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.6-12.el6 will be installed
---> Package vim-common.x86_64 2:7.4.629-5.el6_8.1 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-5.el6_8.1.x86_64
--> Running transaction check
---> Package vim-filesystem.x86_64 2:7.4.629-5.el6_8.1 will be installed
--> Finished Dependency Resolution Dependencies Resolved =======================================================================================================
Package Arch Version Repository Size
=======================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-5.el6_8.1 base 1.0 M
Installing for dependencies:
gpm-libs x86_64 1.20.6-12.el6 base 28 k
vim-common x86_64 2:7.4.629-5.el6_8.1 base 6.7 M
vim-filesystem x86_64 2:7.4.629-5.el6_8.1 base 15 k Transaction Summary
=======================================================================================================
Install 4 Package(s) Total download size: 7.8 M
Installed size: 23 M
Downloading Packages:
(1/4): gpm-libs-1.20.6-12.el6.x86_64.rpm | 28 kB 00:00
(2/4): vim-common-7.4.629-5.el6_8.1.x86_64.rpm | 6.7 MB 00:09
(3/4): vim-enhanced-7.4.629-5.el6_8.1.x86_64.rpm | 1.0 MB 00:01
(4/4): vim-filesystem-7.4.629-5.el6_8.1.x86_64.rpm | 15 kB 00:00
-------------------------------------------------------------------------------------------------------
Total 682 kB/s | 7.8 MB 00:11
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-8.el6.centos.12.3.x86_64 (@anaconda-CentOS-201605220104.x86_64/6.8)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : gpm-libs-1.20.6-12.el6.x86_64 1/4
Installing : 2:vim-filesystem-7.4.629-5.el6_8.1.x86_64 2/4
Installing : 2:vim-common-7.4.629-5.el6_8.1.x86_64 3/4
Installing : 2:vim-enhanced-7.4.629-5.el6_8.1.x86_64 4/4
Verifying : 2:vim-enhanced-7.4.629-5.el6_8.1.x86_64 1/4
Verifying : 2:vim-filesystem-7.4.629-5.el6_8.1.x86_64 2/4
Verifying : 2:vim-common-7.4.629-5.el6_8.1.x86_64 3/4
Verifying : gpm-libs-1.20.6-12.el6.x86_64 4/4 Installed:
vim-enhanced.x86_64 2:7.4.629-5.el6_8.1 Dependency Installed:
gpm-libs.x86_64 0:1.20.6-12.el6 vim-common.x86_64 2:7.4.629-5.el6_8.1
vim-filesystem.x86_64 2:7.4.629-5.el6_8.1 Complete!

在线安装wget:

 # yum -y install wget

在线安装git:

 # yum install git

安装docker

 [root@localhost ~]# yum install docker
[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

centos7查看端口是否开放:https://jingyan.baidu.com/article/9113f81b4713252b3214c788.html
1、添加开放端口:

[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --zone=public --add-port=90/tcp --permanent && firewall-cmd --zone=public --add-port=3306/tcp --permanent && firewall-cmd --zone=public --add-port=3307/tcp --permanent && firewall-cmd --zone=public --add-port=5637/tcp --permanent && firewall-cmd --zone=public --add-port=1521/tcp --permanent && firewall-cmd --zone=public --add-port=15672/tcp --permanent && firewall-cmd --zone=public --add-port=27017/tcp --permanent

[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --zone=public --add-port=90/tcp --permanent && firewall-cmd --zone=public --add-port=3306/tcp --permanent && firewall-cmd --zone=public --add-port=3307/tcp --permanent && firewall-cmd --zone=public --add-port=5637/tcp --permanent && firewall-cmd --zone=public --add-port=1521/tcp --permanent && firewall-cmd --zone=public --add-port=15672/tcp --permanent && firewall-cmd --zone=public --add-port=27017/tcp --permanent
success
success
success
success
success
success
success
success

2、重载防火墙:firewall-cmd --reload

[root@localhost ~]# firewall-cmd --reload
success

3、查看防火墙开放端口:iptables-save

[root@localhost ~]# iptables-save
-A IN_public_allow -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 443 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 3306 -m conntrack --ctstate NEW -j ACCEPT
-A IN_public_allow -p tcp -m tcp --dport 3307 -m conntrack --ctstate NEW -j ACCEPT

4、显示出当前主机打开的所有端口:netstat -tlunp

[root@localhost ~]# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 705/rpcbind
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 3506/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1122/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1130/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2676/master
tcp6 0 0 :::111 :::* LISTEN 705/rpcbind
tcp6 0 0 :::22 :::* LISTEN 1122/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1130/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2676/master
udp 0 0 0.0.0.0:878 0.0.0.0:* 705/rpcbind
udp 0 0 0.0.0.0:5353 0.0.0.0:* 718/avahi-daemon: r
udp 0 0 0.0.0.0:38593 0.0.0.0:* 718/avahi-daemon: r
udp 0 0 192.168.122.1:53 0.0.0.0:* 3506/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 3506/dnsmasq
udp 0 0 0.0.0.0:111 0.0.0.0:* 705/rpcbind
udp6 0 0 :::878 :::* 705/rpcbind
udp6 0 0 :::111 :::* 705/rpcbind

【2019年6月27日 10:59:09】
CentOS命令修改系统时间同步

 [root@localhost ~]# date
Thu Jun 27 18:53:21 CST 2019
[root@localhost ~]# hwclock --show
Thu 27 Jun 2019 06:54:09 PM CST -0.128977 seconds
[root@localhost ~]# hwclock --set --date '2019-06-27 10:55:30'
[root@localhost ~]# hwclock --show
Thu 27 Jun 2019 10:55:35 AM CST -0.146720 seconds
[root@localhost ~]# hwclock --hctosy
[root@localhost ~]# clock -w
[root@localhost ~]# init 0

【2019年7月12日 14:24:15】
CentOS安装nmap端口查看工具:yum install nmap

[root@localhost ~]# rpm -qa | grep nmap
nmap-ncat-6.40-16.el7.x86_64
[root@localhost ~]# yum install nmap
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.163.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 6.5 MB 00:00:03
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:6.40-16.el7 will be installed
--> Processing Dependency: nmap-ncat = 2:6.40-16.el7 for package: 2:nmap-6.40-16.el7.x86_64
--> Running transaction check
---> Package nmap-ncat.x86_64 2:6.40-13.el7 will be updated
---> Package nmap-ncat.x86_64 2:6.40-16.el7 will be an update
--> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================
Installing:
nmap x86_64 2:6.40-16.el7 base 3.9 M
Updating for dependencies:
nmap-ncat x86_64 2:6.40-16.el7 base 206 k Transaction Summary
================================================================================================================================================================================
Install 1 Package
Upgrade ( 1 Dependent package) Total download size: 4.2 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/2): nmap-ncat-6.40-16.el7.x86_64.rpm | 206 kB 00:00:00
(2/2): nmap-6.40-16.el7.x86_64.rpm | 3.9 MB 00:00:01
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.0 MB/s | 4.2 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 2:nmap-ncat-6.40-16.el7.x86_64 1/3
Installing : 2:nmap-6.40-16.el7.x86_64 2/3
Cleanup : 2:nmap-ncat-6.40-13.el7.x86_64 3/3
Verifying : 2:nmap-ncat-6.40-16.el7.x86_64 1/3
Verifying : 2:nmap-6.40-16.el7.x86_64 2/3
Verifying : 2:nmap-ncat-6.40-13.el7.x86_64 3/3 Installed:
nmap.x86_64 2:6.40-16.el7 Dependency Updated:
nmap-ncat.x86_64 2:6.40-16.el7 Complete!

【Mon Jul 03 2017 17:50:16 GMT+0800】
Linux下编译安装mysql-5.5.20.tar.gz
(1)创建MySQL安装目录
[root@localhost ~]# mkdir -p /usr/local/mysql/
(2)创建数据存放目录
[root@localhost ~]# mkdir -p /usr/data/mysql/
(3)创建用户及用户组和赋予数据存放目录权限
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost ~]# chown mysql.mysql -R /usr/data/mysql/
------Start Copy------
groupadd mysql
useradd -g mysql mysql
chown mysql.mysql -R /usr/data/mysql/
------End Copy------
(4)cmake(MySQL5.5以后是通过cmake来编译的)
下载:wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
解压:tar zxvf cmake-2.8.4.tar.gz
cd cmake-2.8.4
安装:./configure make && make install
[root@localhost mnt]# tar zxvf cmake-2.8.4.tar.gz
[root@localhost mnt]# cd cmake-2.8.4
[root@localhost cmake-2.8.4]# ./configure make && make install
------Start Copy------
tar zxvf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure make && make install
------End Copy------
(5)解压mysql-5.5.20.tar.gz
[root@localhost mnt]# tar zxvf mysql-5.5.20.tar.gz
[root@localhost mnt]# cd mysql-5.5.20
------Start Copy------
tar zxvf mysql-5.5.20.tar.gz
cd mysql-5.5.20
------End Copy------
(6)编译mysql-5.5.20
[root@localhost mysql-5.5.20]#
------Start Copy------
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/data/mysql \
-DMYSQL_UNIX_ADDR=/usr/data/mysql/mysqld.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_TCP_PORT=3306 \
-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_UNIX_ADDR=/usr/data/mysql/mysql.sock \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0
------End Copy------
[root@localhost mysql-5.5.20]# make && make install
(7)复制配置文件:(/mnt/mysql-5.5.20)
[root@localhost mysql-5.5.20]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.5.20]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.5.20]# chmod 755 /etc/init.d/mysqld
------Start Copy------
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
------End Copy------
(8)初始化数据库(/usr/local/mysql)
[root@localhost mysql-5.5.20]# bash /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/data/mysql/
------Start Copy------
bash /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/data/mysql/
------End Copy------
(9)启动mysql服务并查看
[root@localhost mysql-5.5.20]# /etc/init.d/mysqld start
[root@localhost mysql-5.5.20]# ps -ef |grep mysql
(10)通过命令行登录管理MySQL服务器,初始密码为空
[root@localhost mysql-5.5.20]# /usr/local/mysql/bin/mysql -u root -p
(11)修改root密码,并测试
mysql> use mysql;
mysql> update user set password=PASSWORD("qqqqqq") where user='root';
mysql> FLUSH PRIVILEGES;
------Start Copy------
use mysql;
update user set password=PASSWORD("qqqqqq") where user='root';
FLUSH PRIVILEGES;
exit
------End Copy------
再次启动MySQL服务器验证修改过的密码
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql         |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
(12)设置MySQL开机启动
[root@localhost mysql-5.5.20]# cd /etc
[root@localhost etc]# vim rc.local
---------
7 touch /var/lock/subsys/local
8 /usr/local/apache2/bin/apachectl start
9 /etc/init.d/mysqld start
---------
[root@localhost etc]# cat rc.local
(12)创建别名:alias mysql='/usr/local/mysql/bin/mysql -u root -p'
shell脚本自动安装:

【2018年2月28日 21:32:55】
启动(包括:yum -y remove http* mysql* php*,这种一键装方式)
[root@localhost ~]# /etc/init.d/mysqld start
修改密码后:
[root@localhost ~]# mysql -uroot -p
远程连接出现Error 1130问题
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>flush privileges;
mysql>select host, user from user

对于“ERROR 1062 (23000): Duplicate entry '%-root' for key 1”报错的解决方案
mysql> update user set host='%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
然后查看了下数据库的host信息如下:
mysql> select host from user where user = 'root';
+-----------------------+
| host |
+-----------------------+
| % |
| 127.0.0.1 |
| localhost.localdomain |
+-----------------------+
3 rows in set (0.00 sec)
host已经有了%这个值,所以直接运行命令,即可用工具链接
mysql>flush privileges;
启动apache
[root@localhost ~]# service httpd start
Starting httpd: [ OK ]

【Sat Jun 17 2017 09:20:20 GMT+0800】
简要步骤:
1、VMware Workstation安装
(1)“文件”→“新建虚拟机(N)...”
(2)弹出“新建虚拟机安装向导”选“典型(推荐)(T)”,单击“下一步”
(3)安装客户机操作系统选择“稍后安装操作系统”
(4)选择客户机操作系统:
-客户机操作系统选择“Linux”;
-版本选择“CentOS”
(5)命名虚拟机
-虚拟机名称:CentOS
-位置:F:\sys\CentOS
(6)指定磁盘容量:
-最大磁盘大小(GB)(S):5.0(选择5GB)
-选择“将虚拟磁盘存储为单个文件”
(7)已准备好创建虚拟机
(8)编辑虚拟机设置:
-将内存改为“512M”或“256M”
-网络适配器定义为:“VMnet1”
-移除不需要的:“USB 控制器”、“声卡”、“打印机”
-在“CD/DVD (IDE)”的右侧面板的“连接”→“适用 ISO 镜像文件”,浏览找到“CentOS-5.5-i386-bin-DVD.iso”
(9)开启次虚拟机
2、CentOS5.5安装
移除分区、取消桌面、添加开发工具包
3、检测安装是否正确
(1)查看IP地址:ifconfig
(2)防火墙:iptables -L
(3)查看SELinux状态:sestauts
(4)检测开发工具包是否已安装:rpm -qa | grep gcc
图文步骤:
1、VMware Workstation安装
(1)“文件”→“新建虚拟机(N)...”


(2)弹出“新建虚拟机安装向导”选“典型(推荐)(T)”,单击“下一步”


(3)安装客户机操作系统选择“稍后安装操作系统”


(4)选择客户机操作系统:
-客户机操作系统选择“Linux”;
-版本选择“CentOS”


(5)命名虚拟机
-虚拟机名称:CentOS
-位置:F:\sys\CentOS


(6)指定磁盘容量:
-最大磁盘大小(GB)(S):5.0(选择5GB)
-选择“将虚拟磁盘存储为单个文件”


(7)已准备好创建虚拟机


(8)编辑虚拟机设置:
-将内存改为“512M”或“256M”
-网络适配器定义为:“VMnet1”
-移除不需要的:“USB 控制器”、“声卡”、“打印机”
-在“CD/DVD (IDE)”的右侧面板的“连接”→“适用 ISO 镜像文件”,浏览找到“CentOS-5.5-i386-bin-DVD.iso”


(9)开启次虚拟机
2、CentOS5.5安装
(1)进入下图界面,回车

选择skip回车

进入下图界面,点击“下一步”

选择“English(English)”,点击“下一步”

选择”U.S. English“,点击“下一步”

下图弹框选择”Yes“,

继续点击”Yes“,点击“下一步”

格式化磁盘,选择"Remove linux partitions on selected drives and create default layou"(在选择移除Linux分区驱动并且创建默认的布局),弹框移除分区,选择"Next"→“Yes”

配置IP

选择“OK”

点击“下一步”选择“继续”

输入密码(qqqqqq),点击“下一步”

把“Desktop - Gnome ”取消,并且选择"Customize now",点击“下一步”

在“Development”的右面选择“Development Tools”,点击“下一步”

点击“下一步”等待安装

点击“Rebot”重启,第一次重启进入下图界面

Run Tool 用tab选择,选择好后,回车,进入下图界面

按照上图选择好后,tab到"OK",回车,返回下图界面

tab到“Exit”回车,进入系统。
3、检测安装是否正确
(1)查看IP地址:ifconfig


(2)防火墙:iptables -L


(3)查看SELinux状态:sestauts


(4)检测开发工具包是否已安装:rpm -qa | grep gcc

Linux-VMware Workstation&CentOS-5.5-i386-bin-DVD安装的更多相关文章

  1. Linux - VMware和Centos安装

    目录 Linux - VMware和Centos安装 选择性 下载centos系统ISO镜像 安装虚拟机VMware虚拟机 1. 准备vmware软件 2. 解压软件包, 当前选择vm12 3. vm ...

  2. VMware Workstation Pro 15 for Windows下载与安装

    VMware Workstation Pro 15 for Windows下载与安装 一.下载 下载地址:https://my.vmware.com/cn/web/vmware/details?dow ...

  3. 一、VMware Workstation 15中文破解版 下载与安装(附密钥)

    下载地址: 下载地址VMware Workstation Pro 15.5.0 Build 14665864https://download3.vmware.com/software/wkst/fil ...

  4. VMware workstation CentOs 7 虚拟机网卡设置为NAT模式并设置固定IP

    一.背景知识      虚拟机网络模式 无论是vmware workstation,virtual box,virtual pc等虚拟机软件,一般来说,虚拟机有三种网络模式: 1.桥接 2.NAT 3 ...

  5. 【Linux】一步一步学Linux——VMware Workstation 15 Pro安装图解教程(06)

    目录 00. 目录 01. VMware Workstation Pro15下载 02. VMware Workstation Pro15安装 03. VMware Workstation Pro 1 ...

  6. VMware Workstation(虚拟机软件) V10.0 简体中文版可以安装了

    在虚拟机软件中VMware Workstation算是一款非常强大较稳定的软件了,今天 VMware Workstation 10.0正式发布了,最让人欣喜的是该版本终于有了简体中 文版了,从现在开始 ...

  7. 安装VMware workstation遇到的两个问题:安装过程中的DLL问题和安装后打开需要的管理权限问题

    1.安装过程中遇到Microsoft runtime DLL安装程序未能完成安装的问题? 在遇到这个问题时不要点击确定,需要在开始菜单中输入%temp%,然后跳转到一个文件夹里,找到后缀为setup的 ...

  8. Linux ->> VMWare Workstation虚拟机里的UBuntu系统安装VMWare-tools

    1) mkdir创建一个临时目录 2)复制gz压缩包到临时目录下 3)解压到当前目录 4)运行.pl文件安装 root@ubuntu:/# root@ubuntu:/# cd /tmp/ root@u ...

  9. 使用VMware Workstation 14 Player或者Oracle VM VirtualBox安装Fedora-Workstation-netinst-x86_64-27-1.6操作系统的相关记录

    无论是在使用哪个(VMware或者Oracle VM)都遇到了一个问题:即使在安装完Fedoras操作系统之后,进行Reboot还是会进入之前一摸一样的安装界面,相当于再次安装.然而最最有效的解决办法 ...

  10. [Linux.NET]在CentOS 7.x中编译方式安装Nginx

    Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,供俄罗斯大型的 ...

随机推荐

  1. Interpreting the genomic landscape of speciation: a road map for finding barriers to gene flow

    1.摘要 物种形成是种群间生殖隔离的进化过程,是连续的.复杂的,涉及多个相互作用的屏障.在完成之前,这一过程的影响会随着基因组的不同而变化,并可能导致具有分化和分化波峰和波谷的异质性基因组景观.当基因 ...

  2. margin的垂直方向塌陷

    标签(空格分隔): margin塌陷 margin垂直方向塌陷问题: 如下代码: <!DOCTYPE html> <html lang="en"> < ...

  3. linux 安装java环境

    1.检查是否安装或者linux系统自带jdK 命令:java -version 查找JDK相关包是否被安装: rpm -qa |grep jdk rpm -qa |grep gcj 删除JDK相关包: ...

  4. WPF网格绑定控件并控制控件是否可读

    <DataGridTemplateColumn Width="100" Header="实测值"> <DataGridTemplateColu ...

  5. Polar Code(1)关于Polar Code

    Polar Codes于2008年由土耳其毕尔肯大学Erdal Arikan教授首次提出,Polar Codes提出后各通信巨头都进行了研究.2016年11月18日(美国时间2016年11月17日), ...

  6. layer is not defined

    项目中使用layui中,引入新旧版本出现的一个问题. 使用console.log(layer) 打印出来的,显示使用的版本是1.8.0 但是页面中引入的layui有好几个.就是不使用最新的. /*这里 ...

  7. Babel 6 概述

    babel-core 只转换语法(如箭头函数) babel-polyfill 由core-js和regenerator runtime组成. 1 core-js用来支持新的全局变量(例如 Promis ...

  8. python3作业:模拟登录

    __author__ = "bin007" customer = {}#存储用户信息#处理用户信息文件try: with open('login.txt','r',encoding ...

  9. OO第二单元学习总结

    前言: 第二单元总共包括三次电梯调度作业.这三次作业在笔者看来是为了让学生了解什么是多线程,多线程的好处及可能存在的潜在问题,对于多线程的安全问题应该如何解决和保证结果的唯一性和正确性.那么接下来笔者 ...

  10. ECMA262学习笔记(二)

    Property特性:特性用于定义和解释命名属性的状态. ECMAScript建立执行环境: 解释执行全局代码或使用eval函数输入的代码会创建并进入一个新的执行环境.每次调用ECMA脚本代码定义的函 ...