部分涉及到Linux、Nginx、tomcat、MySQL等的点滴操作记录,时间长了,就忘掉了,偶尔整理一下操作的history,就此简要备份一下:

【原】【BG】-一次虚拟化环境实践简要记录: https://www.cnblogs.com/haochuang/p/8862640.htmll

【原】【BG】KVM虚拟化管理 virt manager常用操作:https://www.cnblogs.com/haochuang/p/9540812.html

【原】【BG】三块SAS新磁盘RAID扩展及LVM、mdadm与数据备份等:https://www.cnblogs.com/haochuang/p/9889220.html

【原】【BG】多tomcat+Nginx+Mysql+多服务环境配置及部分过程记录:https://www.cnblogs.com/haochuang/p/9889158.html

SQL相关:

【原】【BG】部分问题处理SQL:https://www.cnblogs.com/haochuang/p/9640356.html

【原】【BG】【SQL之二】批量生成SQL语句及多表查询:https://www.cnblogs.com/haochuang/p/9889491.html


前几天,搞了一台PowerEdge R720机架服务器,在上面搭建了一套虚拟化环境,将一台硬件虚成了多台,满足基本使用。

恰好今天有空,这里做一下简单的记录。

1.过去的记忆

上次搞虚拟化之类服务器这种事情,还是2011年的时候了。

记得那时候用的还是Ubuntu 11.04,而且那时候搞得比现在要复杂得多,那时候Openstack才刚刚兴起,还不稳定,整天看的都是英文文档,在与openstack的各种不稳定作斗争;

那时候我去还参与openstack初期时候的中国区会议,还申请帮忙一起进行活动场地相关准备与支持性工作;

转眼这些年,技术迭代了Docker、K8S,热门技术又变了,沧海桑田一般。

2.关于云的看法

另外关于自建服务器,可能每个人的观点不同。我自己的看法如下:

1.相对具体的数据本身而言,选择云服务器比本地服务器,更为安全;我这里说的安全,是指数据不丢失,是云本身的IAAS层RAID+多副本+异地灾备等天然属性所决定的;但账号密码等上层应用服务层的安全是另外一回事;很多人认为云不安全,其实是对后者不放心;但就IAAS层而言,还无争议的肯定是云服务更安全;

2.云服务的成本更低,效率更高;选择云服务,云服务供应商的规模化运营降低了成本,技术资源更强大,处理问题更快;本地的话可能需要运维人员,需要另外增加额外成本,而且单枪匹马,难以与一个技术team的战斗力匹敌;

3.云服务集成的第三方附加产品可以使用,很多不需要再去自建,节省时间;

4.云服务扩展更灵活,按需采购使用,而不是像本地,搭建环境时候的架构本身就决定了可以支撑多少计算、存储、网络能力;

。。。

anyway,做好当下的事情,说干就干,我先把云服务搞起来再说,前几天已经高过了,现在将部分要点简要记录一下;

在搞得过程中,我参考了部分其他人的经验,部分可能还有用处,参考的部分URL如下:

QEMU-KVM安装部署虚拟机:https://www.linuxidc.com/Linux/2017-05/143292.htm

CentOS 7下如何配置KVM虚拟化环境:https://www.centos.bz/2018/02/centos-7%E4%B8%8B%E5%A6%82%E4%BD%95%E9%85%8D%E7%BD%AEkvm%E8%99%9A%E6%8B%9F%E5%8C%96%E7%8E%AF%E5%A2%83/

Centos7.4安装kvm虚拟机(使用virt-manager管理):http://www.cnblogs.com/kevingrace/p/8377645.html
KVM 虚拟化 virsh,virt-manager 删除虚拟机:https://www.linuxidc.com/Linux/2017-01/140009.htm
centos7 通过kvm+vnc 实现远程桌面虚拟化和创建windows、Linux虚拟机:https://blog.csdn.net/qq_21398167/article/details/46413107
KVM和远程管理工具virt-manager的部署:https://blog.csdn.net/qq271757232/article/details/18949707

本来想详细分步骤记录一下,但是时间紧急,就偷懒了,我先把主要思路写一下,然后通过history中把之前部分用到的命令贴出来,如果有需要的可以参考;

-------------------------------------------------------------------

基本步骤要点:

1.先检查硬件配置,并给硬件设备做RAID;

2.下载系统镜像,推荐CentOS或者UbuntuServer版本;

3.使用USB制作虚拟启动盘;

4.使用虚拟盘安装操作系统;

5.Centos网络与桥接配置等;

6.虚拟化层(Virt-manager\QEMU-KVM)安装;

7.VNC-Viewer安装;

8.虚拟机镜像制作;

9.虚拟机集群规划管理,单台虚拟机启动与配置等;

10.虚拟机内部环境配置,虚拟机之间配置与管理;

-------------------------------------------------------------------

硬件服务器:戴尔PowerEdge R720 机架式服务器

具体操作步骤,现在不详细记录了,我直接history了一下操作的部分历史如下,供参考:

  1. [root@localhost ~]# history | cut -c - > history
  2. su - haochuang
  3. clear
  4. yum install -y net-tools
  5. dmesg |grep eth
  6. ls /sbin
  7. ls /sbin/if*
  8. ls /etc/sysconfig/network-scripts/
  9. cd /etc/sysconfig/network-scripts/
  10. ls
  11. cat ifcfg-em1
  12. dmesg |grep -in eth
  13. ifconfig
  14. cat /etc/default/grub
  15. yum install -n net-tools
  16. cat /etc/default/grub
  17. service start network
  18. service restart network
  19. sudo reboot
  20. yum install -n net-tools
  21. yum install -y net-tools
  22. ping www.baidu.com
  23. cd /etc/sysconfig/network-scripts/
  24. ls -la
  25. vi ifcfg-em1
  26. cat ifcfg-em1
  27. cat ifcfg-em2
  28. cat ifcfg-em1
  29. vi ifcfg-em1
  30. sudo reboot
  31. ping www.baidu.com
  32. vi /etc/sysconfig/network-scripts/
  33. cd /etc/sysconfig/network-scripts/
  34. ls
  35. cp ifcfg-em1 ifcfg-eth0
  36. vi ifcfg-eth0
  37. service network restart
  38. systemctl
  39. ifup eth1
  40. ifup eth0
  41. systemctl
  42. systemctl list-unit-files
  43. vi ifcfg-eth0
  44. ls
  45. cp ifcfg-em1 ifcfg-em0
  46. cp ifcfg-eth0 ifcfg-em1
  47. service network restart
  48. systemctl
  49. ifdown ifcfg-em1
  50. ifup ifcfg-em1
  51. ip addr
  52. cat ifcfg-em1
  53. ifdown ifcfg-em1
  54. ifup ifcfg-em1
  55. find / name "ifconfig"
  56. find / name "ifconfig" | more
  57. /etc/init.d/network restart
  58. systemctl
  59. ip addr
  60. ip link whow
  61. ip link show
  62. ip addr show
  63. ls -la
  64. cat ifcfg-em1
  65. cat ifcfg-em4
  66. vi ifcfg-em4
  67. ifup ifcfg-em4
  68. ip addr
  69. ifconfig
  70. ping www.baidu.com
  71. service sshd status
  72. yum install net-tools
  73. ifconfig
  74. pwd
  75. ls -la
  76. cat ifcfg-em4
  77. uname -a
  78. arch
  79. cat lsb_release
  80. cat /prod/lsb_release
  81. yum install qemu-kvm libvirt virt-install bridge-utils
  82. yum install qemu-kvm libvirt virt-install bridge-utilslsmod | grep kvm
  83. lsmod | grep kvm
  84. systemctl start libvirt
  85. yum install qemu-kvm libvirt virt-install bridge-utils
  86. systemctl start libvirtd
  87. systemctl enable libvirtd
  88. pwd
  89. ls -la
  90. cp ifcfg-em0 ifcfg-br0
  91. vi ifcfg-br0
  92. ping 192.168.1.100
  93. ping 192.168.1.101
  94. ping 192.168.1.200
  95. vi ifcfg-br0
  96. ls -la
  97. cp ifcfg-em4 ifcfg-bond0
  98. vi ifcfg-bond0
  99. ifconfig
  100. vi ifcfg-br0
  101. ifconfig
  102. systemctl restart network
  103. ls -la
  104. vi ifcfg-bond0
  105. vi ifcfg-em4
  106. cat ifcfg-em4 ifcfg-bond0
  107. mv ifcfg-em4 ifcfg-em4.bak
  108. mv ifcfg-bond0 ifcfg-em4
  109. ifconfig
  110. ifconfig | more
  111. systemctl restart network
  112. ifconfig |
  113. systemctl restart network | moew
  114. systemctl restart network | more
  115. systemctl restart network
  116. ls -la
  117. vi ifcfg-br0
  118. vi ifcfg-em4
  119. systemctl restart network
  120. systemctl status network.service
  121. ifdown ifcfg-br0
  122. ifdown ifcfg-em4
  123. vi ifcfg-em4
  124. ifdown ifcfg-em4
  125. ifconfig
  126. ifup br0
  127. ifup ifcfg-em4
  128. vi ifcfg-em4
  129. ifconfig
  130. vi ifcfg-em4
  131. systemctl status network.service
  132. systemctl restart network
  133. systemctl status network.service
  134. ls-la
  135. ls -la
  136. ip addr
  137. ip a
  138. ifup ifcfg-br0
  139. ip addr
  140. ip a
  141. ifconfig
  142. ifconfig | more
  143. ls /vat/lib/libvirt/images
  144. ls /var/lib/libvirt/images
  145. ls /var/kvm/images
  146. mkdir -p /var/kvm/images
  147. ls /var/kvm/images
  148. man virt-manager
  149. ifconfig | more
  150. cat ifcfg-em4
  151. cat ifcfg-br0
  152. vi ifcfg-em4
  153. systemctl restart network
  154. ifdown ifcfg-em4
  155. ifdown ifcfg-br0
  156. ifconfig | more
  157. ifup ifcfg-br0
  158. ifconfig | more
  159. ifup ifcfg-em4
  160. cat ifcfg-em4
  161. cat ifcfg-br0
  162. df -lh
  163. egrep '(vmx|svm)' /proc/cpuinfo
  164. vi /etc/sysconfig/selinux
  165. yum install epel-release net-tools vim unzip zip wget
  166. ping www.baidu.com
  167. ifup ifcfg-br0
  168. ping www.baidu.com
  169. ifconfig
  170. ifconfig | more
  171. ifup ifcfg-br0
  172. systemctl restart network
  173. ping www.baidu.com
  174. vi ifcfg-em4
  175. systemctl restart network
  176. ifup ifcfg-em4
  177. ifdown ifcfg-em4
  178. ifup ifcfg-em4
  179. ip a
  180. ifup ifcfg-br0
  181. ifdown ifcfg-br0
  182. ifup ifcfg-br0
  183. ping www.baidu.com
  184. systemctl restart network
  185. ping www.baidu.com
  186. vi ifcfg-br0
  187. vi ifcfg-em4
  188. ls -la
  189. cp ifcfg-em4 ifcfg-em4.bak.
  190. ls -la
  191. vi ifcfg-em4
  192. systemctl restart network
  193. system status network.service
  194. systemctl status network.service
  195. ls
  196. mv ifcfg-eth0 bak.ifcfg-eth0
  197. mv ifcfg-em0 bak.ifcfg-em0
  198. ls
  199. mv ifcfg-em4.bak bak.ifcfg-em4.bak
  200. ls
  201. mv ifcfg-em4.bak. bak.ifcfg-em4.bak.
  202. ls -la
  203. la
  204. ls
  205. sudo reboot
  206. ifcondfig
  207. ifconfig
  208. ifconfig | moer
  209. ifconfig | more
  210. ping www.baidu.com
  211. ip addr
  212. service network restart
  213. cd /etc/networks/
  214. cd /sysconfig
  215. ls
  216. cd /
  217. ls
  218. cd /etc/sysconfig/network
  219. cd /etc/sysconfig/network-scripts/
  220. ls -la
  221. ip a
  222. cat ifcfg-br0
  223. cat ifcfg-em4
  224. ip addr show
  225. ip addr
  226. cat ifcfg-br0
  227. vi ifcfg-br0
  228. cat ifcfg-br0
  229. cat ifcfg-em4
  230. vi ifcfg-br0
  231. cat ifcfg-em4
  232. systemctl restart nwtwork
  233. systemctl restart network
  234. journalctl -xe
  235. cat /var/log/messages | grep network
  236. vi /etc/resolv.conf
  237. vi /var/log/messages
  238. systemctl restart network
  239. journalctl -xe
  240. arp -a
  241. ifconfig
  242. ifconfig | more
  243. ping 192.168.1.1
  244. journalctl -xe
  245. service ssh status
  246. service sshd status
  247. journalctl -xe | more
  248. cat /var/log/messages | grep network
  249. clear
  250. cat /var/log/messages | grep network | more
  251. exit
  252. ifconfig
  253. yum install epel-release net-tools vim unzip zip wget ftp -y
  254. ping www.baidu.com
  255. ifconfig
  256. service network restart
  257. journalctl -xe
  258. ls -la
  259. cd /etc/sysconfig/
  260. ls -la
  261. cd network
  262. cd network-scripts/
  263. ls -la
  264. vi ifcfg-br0
  265. service network restart
  266. systemctl status net
  267. systemctl status network.service
  268. systemctl stop NetworkManager
  269. systemctl disable NetworkManager
  270. systemctl start network.service
  271. ifconfig
  272. journalctl -xe
  273. egrep '(vmx|svm)' --color=always /proc/cpuinfo
  274. lsmod | grep kvm
  275. sestatus
  276. yum install kvm libvirt python-virtinst qemu-kvm virt-viewer tunctl bridge-utils avahi dmidecode qemu-kvm-tools virt-manager qemu-img virt-instal
  277. l net-tools libguestfs-tools -ysystemctl start libvirtd
  278. systemctl enable libvirtd
  279. virsh -c qemu:///system list
  280. ifconfig
  281. yum install qemu-kvm libvirt virt-install bridge-utils -y
  282. systemctl start libvirtd
  283. systemctl enable libvirtd
  284. systemctl status libvirtd
  285. systemctl is-enabled libvirtd
  286. pwd
  287. ls -la
  288. cd
  289. pwd
  290. cd /home
  291. ls -la
  292. groupadd haogroup
  293. useradd -g haogroup -d /home/haoop -m haoop -p haoop
  294. ls -la
  295. su - haochuang
  296. mkdir iso
  297. ls -la
  298. cd iso
  299. ls -la
  300. cd ..
  301. ls -la
  302. mkdir -p /home/kvm-bak
  303. ls -la
  304. vi /etc/sudoers
  305. yum install vsftpd
  306. vi /etc/vsftpd/user_list
  307. service vsftpd restart
  308. su - haochuang
  309. vi /etc/vsftpd/vsftpd.conf
  310. /etc/init.d/messagebus restart
  311. yum install -y kvmvirt-* libvirt bridge-utils qemu-img
  312. virt-install
  313. /etc/init.d/libvirtd start
  314. mkdir /data/
  315. ls -la
  316. cd da
  317. cd /data
  318. ls -la
  319. cat /proc/cpuinfo
  320. virt-install --name scm --ram --disk path=/data/scm.img,size= --vcpus --os-type linux --os-variant rhel7 --network bridge=br0 --graphic
  321. s none --console pty,target_type=serial --location'http://mirrors.163.com/centos/7/os/x86_64/' --extra-args 'console=ttyS0,115200n8 serial' virt-install --name scm --ram --disk path=/data/scm.img,size= --vcpus --os-type linux --os-variant rhel7 --network bridge=br0 --graphic
  322. s none --console pty,target_type=serial --location'http://mirrors.163.com/centos/7/os/x86_64/' --extra-args 'console=ttyS0,115200n8 serial'virt-install --name scm --ram --disk path=/data/scm.img,size= --vcpus --os-type linux --os-variant rhel7 --network bridge=br0 --graphic
  323. s none --console pty,target_type=serial --location 'http://mirrors.163.com/centos/7/os/x86_64/' --extra-args 'console=ttyS0,115200n8 serial' pwd
  324. cat /etc/ssh/sshd_config
  325. cat /etc/ssh/sshd_config | grep X11Forwarding
  326. vi /etc/ssh/sshd_config
  327. passwd haoop
  328. pwd
  329. ls -la
  330. cd /home
  331. ls -la
  332. chown haoop:haogroup iso -R
  333. ls -la
  334. cd iso/
  335. ls -la
  336. firewall-cmd --zone=public --add-port=/tcp --permanent
  337. firewall-cmd --reload
  338. yum install tigervnc
  339. yum -y install tigervnc-server
  340. ls -la
  341. pwd
  342. cd ..
  343. ls -la
  344. cp iso/CentOS--x86_64-DVD-.iso kvm-bak/
  345. cd kvm-bak/
  346. ls -la
  347. cd ..
  348. ls -la
  349. chown haoop:haogroup kvm-bak -R
  350. ls -la
  351. cd kvm-bak/
  352. ls -la
  353. su - haoop
  354. ls -la
  355. virt-install --network bridge=br0,model=virtio --name hao --ram= --vcpus= --disk path=/home/kvm-bak/vm-images/hao.img,size=,bus=virtio --c
  356. drom /home/kvm-bak/CentOS--x86_64-DVD-.iso --graphics none --noautoconsole --acceleratels /home/kvm-bak/vm-images
  357. rm -rf /home/kvm-bak/vm-images/hao.img
  358. virt-install --network bridge=br0,model=virtio --name hao --ram= --vcpus= --disk path=/home/kvm-bak/vm-images/hao.img,size=,bus=virtio --c
  359. drom /home/kvm-bak/CentOS--x86_64-DVD-.iso --graphics none --noautoconsole --acceleratevirt-install --network bridge=br0,model=virtio --name haotest --ram= --vcpus= --disk path=/home/kvm-bak/vm-images/hao.img,size=,bus=virtio
  360. --cdrom /home/kvm-bak/CentOS--x86_64-DVD-.iso --graphics none --noautoconsole --acceleratevirt-install --network bridge=br0,model=virtio --name haotest --ram= --vcpus= --disk path=/home/kvm-bak/vm-images/haotest.img,size=,bus=vi
  361. rtio --cdrom /home/kvm-bak/CentOS--x86_64-DVD-.iso --graphics none --noautoconsole --acceleratels -la
  362. cd vm-images/
  363. ls -la
  364. virsh console haotest
  365. ping www.baidu.com
  366. w
  367. ps -ef | grep virsh
  368. kill -
  369. pwd
  370. ls -la
  371. cd
  372. ls -la
  373. cd /home
  374. ls -la
  375. cd ..
  376. ls -la
  377. cd data
  378. ls -la
  379. virt-namager
  380. virt-manager
  381. ls -la
  382. rm -rf scm.img
  383. ls -la
  384. virt-install --network bridge=br0,model=virtio --name vm1 --ram= --vcpus= --disk path=/vm-images/vm1.img,size=,bus=virtio --location 'http:
  385. //mirrors.163.com/centos/7/os/x86_64/' --graphics none --noautoconsole --acceleratevirt-manager
  386. ssh -X 192.168.1.200
  387. virt-manager
  388. clear
  389. virsh --help |grep undefine
  390. virsh list --all
  391. virsh destory scm
  392. virsh destroy scm
  393. yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
  394. yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
  395. yum -y install gcc python-devel pip install numpy
  396. mkdir /application/
  397. cd /application/
  398. git clone git://github.com/retspen/webvirtmgr.git
  399. git clone https://github.com/retspen/webvirtmgr.git
  400. wget http://www.sqlite.org/sqlite-3.5.6.tar.gz
  401. netstat -an |grep
  402. service vncserver restart
  403. yum -y install wget
  404. wget http://www.sqlite.org/sqlite-3.5.6.tar.gz
  405. ls -la
  406. cd sqlite-3.5./
  407. tar -xvf sqlite-3.5..tar.gz
  408. cd sqlite-3.5./
  409. ls -la
  410. ./configure --disable-tcl
  411. make;make install
  412. cd /application/webvirtmgr
  413. ls -la
  414. pip install -r requirements.txt
  415. pip install -r
  416. cat requirements.txt
  417. ./manage.py syncdb
  418. rpm -y install django
  419. pip install -r requirements.txt
  420. yum -y install pip
  421. export PATH=$HOME/bin:/usr/local/bin:$PATH
  422. export PATH=$HOME/bin:/usr/local/python27/bin:/usr/local/bin:$PATH
  423. source .zshrc
  424. yum -y install pip
  425. pip install -r requirements.txt
  426. yum install epel-release
  427. yum install -y python-pip
  428. pip install -r requirements.txt
  429. ./manage.py syncdb
  430. ./manage.py createsuperuser
  431. mkdir -pv /var/www
  432. mkdir -p /var/www
  433. cp -Rv /application/webvirtmgr /var/www/webvirtmgr
  434. vi /etc/sysconfig/libvirtd
  435. vi /etc/libvirt/libvirtd.conf
  436. vi /etc/nginx/nginx.conf
  437. systemctl restart libvirtd.service
  438. vi /etc/nginx/conf.d/webvirtmgr.conf
  439. yum install -y nginx
  440. vi /etc/nginx/conf.d/webvirtmgr.conf
  441. ifconfig
  442. ll /home/kvm-bak/vm-images
  443. ll /home/kvm-bak/
  444. clear
  445. yum -y install qemu-kvm libvirt virt-install bridge-utils
  446. lsmod | grep kvm
  447. systemctl start libvirtd
  448. systemctl enable libvirtd
  449. cat /etc/sysconfig/network-scripts/ifcfg-br0
  450. cd /etc/sysconfig/network-scripts/
  451. ls
  452. cat ifcfg-br0
  453. systemctl restart network
  454. systemctl status network.service
  455. clear
  456. ifconfig
  457. virt-install --network bridge=br0,model=virtio --name haochuang --ram= --vcpus= --disk path=/home/kvm-bak/vm-images/haochuang.img,size=,bus=virtio -
  458. -cdrom /home/kvm-bak/CentOS--x86_64-DVD-.iso --graphics none --noautoconsole --acceleratefirewall-cmd --zone=public --add-port=/tcp --permanent
  459. firewall-cmd --reload
  460. virsh list --all
  461. virsh start hao
  462. virsh start haochuang
  463. cat /proc/cpuinfo | egrep vmx|svm
  464. cat /proc/cpuinfo | egrep 'vmx|svm'
  465. virsh list
  466. virsh list --all
  467. history
  468. lsmod | grep kvm
  469. ll /dev/kvm
  470. brctl show
  471. ifconfig |head -
  472. ping www.baidu.com
  473. yum -y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64 libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64
  474. yum -y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64 libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64 libvirt-java.noarc
  475. h libvirt-python.x86_64 libiscsi-1.7.-.el6.x86_64 dbus-devel virt-clone tunctl virt-manager libvirt libvirt-python python-virtinstyum groupinstall "X Window System"
  476. yum install -y dejavu-lgc-sans-fonts
  477. yum groupinstall -y "Fonts"
  478. systemctl enable libvirtd
  479. systemctl start libvirtd
  480. ll /data/iso
  481. ll /data
  482. mkdir -p /data/iso
  483. ls -la
  484. ls /home/iso/
  485. cp /home/iso/CentOS--x86_64-DVD-.iso /data/iso
  486. ls /data/iso
  487. netstat -anp | grep
  488. yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer
  489. brctl show
  490. lscpu
  491. ls /var/lib/libvirt/images
  492. ls -la
  493. ls /data/iso/
  494. virt-install --name haochuangVM0409 --ram --vcpus -f /home/kvm-bak/vm-images/haochuangVM0409.qcow2 --os-type linux --os-variant rhel6 --network brid
  495. ge=br0 --cdrom /data/iso/CentOS--x86_64-DVD-.iso --graphics vnc,listen=0.0.0.0,port=5920rpm -qf /usr/bin/virt-install
  496. ls /usr/bin/qemu-kvm
  497. virt-install --os-variant list
  498. virsh list --all
  499. /usr/bin/qemu-kvm
  500. modprobe kvm
  501. systemctl stop firewalld.service
  502. modprobe kvm-intel
  503. lsmod | grep kvm
  504. yum install -y qemu-kvm libvirt virt-manager qemu-kvm-tools
  505. yum install vnc-server tigervnc -y
  506. vncpasswd
  507. qemu-img create -o preallocation=metadata -f qcow2 /home/kvm-bak/vm-images/cent7.qcow2 20G
  508. ls /home/kvm-bak/vm-images/cent7.qcow2 -la
  509. netstat -an | grep
  510. ps -ef | grep vnc
  511. yum install vnc-server tigervnc -y
  512. service vnc status
  513. /bin/systemctl tatus
  514. /bin/systemctl status
  515. ps aux | grep kvm
  516. iptables -L
  517. ls /etc/systemd/system/vncservice@:.service
  518. ls /etc/systemd/system/vncservice
  519. ls /etc/systemd/system/vncservice*
  520. sudo systemctl stop firewalld.service
  521. sudo systemctl disable firewalld.service
  522. sudo systemctl daemon.reload
  523. sudo systemctl stop firewalld.service
  524. service vncserver restart
  525. vncserver
  526. service vncserver restart
  527. yum groupinstall Desktop
  528. ping www.baidu.com
  529. yum install tigervnc-server
  530. yum install xorg-x11-fonts-Type1
  531. vi /etc/sysconfig/vncservers
  532. service vncserver restart
  533. yum update
  534. vncserver -kill :
  535. service vncserver stop
  536. service vncserver restart
  537. service vncserver start
  538. service vncserver restart
  539. yum check-update
  540. yum groupinstall "X Window System"
  541. yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
  542. yum install tigervnc-server -y
  543. ls /etc/systemd/system/
  544. cd /etc/systemd/system/
  545. ls
  546. ls /lib/systemd/sytem/vncserver@.service
  547. ls /lib/systemd/sytem/vncserver
  548. ls /lib/systemd/sytem/vncserver*
  549. ls /lib/systemd/sytem/
  550. ls /lib/systemd/system/vncserver@.service
  551. cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:.service
  552. vi /etc/systemd/system/vncserver@:.service
  553. systemctl daemon-reload
  554. sudo systemctl enable vncserver@:.service
  555. sudo systemctl start vncserver@:.service
  556. systemctl start vncserver@:.service
  557. systemctl status vncserver@:.service
  558. ls -la /tmp
  559. ls -la /tmp/.X11-unix
  560. rm -rf /tmp/.X11-unix
  561. rm -rf /tmp/.XIM-unix
  562. ls -la /tmp
  563. curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
  564. systemctl disable vncserver@:.service
  565. systemctl enabled vncserver@:.service
  566. yum install tigervnc-server -y
  567. systemctl daemon-reload
  568. systemctl enable vncserver@:.service
  569. systemctl start vncserver@:.service
  570. systemctl start vncserver@:.service
  571. rm -rf /tmp/.X11-unix/*
  572. systemctl enable vncserver@:1.service
  573. ps -ef | grep vnc
  574. ps -ef | grep vnc*
  575. ps -ef | grep *vnc*
  576. systemctl stop firewalld.service
  577. systemctl disable firewalld.service
  578. yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
  579. unlink /etc/systemd/system/default.target
  580. ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
  581. reboot
  582. clear
  583. service vncserver status
  584. locate vncserver
  585. yum -y install locate
  586. clear
  587. ps aux | grep vncserver
  588. lsof -i:5901
  589. ps aux | grep vnc
  590. vi /etc/sysconfig/iptables-config
  591. /sbin/iptables -I INPUT -p tcp --dport 5901 -j ACCEPT
  592. /etc/rc.d/init.d/iptables save
  593. /etc/init.d/iptables restart
  594. iptables-save > /etc/iptables-config
  595. iptables-restore < /etc/iptables-config
  596. firewall-cmd --zone=public --add-port=5901/tcp --permanent
  597. firewall-cmd --reload
  598. sudo firewall–cmd—permanent—add–service vnc–server
  599. service vncserver restart
  600. service vncserver status
  601. netstat -an | grep 5901
  602. netstat -an | grep 5900
  603. netstat -an | grep 59*
  604. netstat -an | grep 5900
  605. sudo firewall-cmd --permanent --add-service vnc-server
  606. lsof -i:5901
  607. lsof -i:5900
  608. service vncserver status
  609. service vncserver restart
  610. systemctl daemon-reload
  611. service vncserver restart
  612. systemctl daemon-reload
  613. service vncserver status
  614. firewall-cmd --permanent --add-service vnc-server
  615. systemctl restart firewalld.service
  616. systemctl daemon-reload
  617. ps -ef | grep vnc
  618. systemctl enable vncserver@:1.service
  619. systemctl start vncserver@:1.service
  620. systemctl status vncserver@:1.service
  621. rm -rf /tmp/.X11-unix/
  622. vncserver -kill :1
  623. systemctl start vncserver@:1.service
  624. systemctl status vncserver@:1.service -l
  625. su - haoop
  626. systemctl daemon-reload
  627. ps -ef | grep vnc
  628. systemctl stop firewalld.service
  629. systemctl disable firewalld.service
  630. systemctl start vncserver@:1.service
  631. systemctl status vncserver@:1.service
  632. netstat -anp | grep 5901
  633. service vncserver restart
  634. systemctl daemon-reload
  635. systemctl enable vncserver@:1.service
  636. systemctl start vncserver@:1.service
  637. systemctl status vncserver@:1.service
  638. rm -rf /tmp/.X11-unix/*
  639. systemctl daemon-reload
  640. ystemctl start vncserver@:1.service
  641. systemctl start vncserver@:1.service
  642. systemctl status vncserver@:1.service
  643. firewall-cmd --permanent --add-service vnc-server
  644. systemctl restart firewalld.service
  645. rm -rf /tmp/.X11-unix/
  646. vncserver -kill :1
  647. systemctl start vncserver@:1.service
  648. journalc
  649. systemctl status vncserver@:1.service
  650. service iptables stop
  651. netstat -lnt |grep 590*
  652. ls /var/log/secure
  653. vi /var/log/secure
  654. firewall-cmd --state
  655. systemctl stop firewalld.service
  656. systemctl disable firewalld.service
  657. service iptables stop
  658. service iptables status
  659. systemctl stop firewalld.service
  660. systemctl disable firewalld.service
  661. vi /etc/sysconfig/vncservers
  662. vi/etc/sysconfig/iptables
  663. vi /etc/sysconfig/iptables
  664. ls /etc/sysconfig/iptables
  665. iptables –A INPUT–m state –state NEW –m tcp –p tcp –dport 5901 –j ACCCEPT
  666. iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 5901 –j ACCCEPT
  667. iptables -A INPUT -p tcp --dport 80 -j ACCEP
  668. iptables -h
  669. vi /etc/sysconfig/iptables
  670. firewall-cmd --state
  671. firewall-cmd --list-all
  672. iptables -L -n -v
  673. iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 5901 –j ACCCEPT
  674. systemctl stop firewalld.service
  675. systemctl disable firewalld
  676. systemctl stop firewalld
  677. firewall-cmd --version
  678. firewall-cmd status
  679. firewall-cmd state
  680. firewall-cmd --help
  681. firewall-cmd --state
  682. systemctl status firewalld
  683. systemctl disable firewalld
  684. systemctl stop firewalld
  685. systemctl stop firewalld
  686. firewall-cmd --reload
  687. virsh vnc display
  688. rm -f -R /tmp/.X11-unix/
  689. systemctl enable vncserver@:1.service
  690. vncserver
  691. ls /home/kvm-bak/vm-images
  692. cd /home/kvm-bak/vm-images
  693. ls -la
  694. rm cent7.qcow2
  695. ls -la
  696. cd ..
  697. ls -la
  698. cp CentOS-7-x86_64-DVD-1708.iso vm-images/
  699. df -lh
  700. pwd
  701. ls /dev/mapper/centos-home
  702. du -sh */home
  703. du -sh /home
  704. fdisk -l
  705. ls -la
  706. cd /home/
  707. ls -la
  708. mkdir
  709. ls /dev
  710. mkdir LVM
  711. ls -la
  712. df -l
  713. df -lh
  714. cat /etc/sysconfig/network-scripts/ifcfg-em4
  715. cat /etc/sysconfig/network-scripts/ifcfg-br0
  716. ping 192.168.1.201
  717. ping 192.168.1.202
  718. ping 192.168.1.2023
  719. ping 192.168.1.203
  720. ls /var/lib/libvirt/images
  721. du -sh /var/lib/libvirt/images
  722. du -sh /var/lib/libvirt/
  723. du -sh /var
  724. yum --help
  725. df l0h
  726. df -lh
  727. ls /var/lib/libvirt/images/
  728. cd /var/lib/libvirt/
  729. ls -la
  730. cd qemu/
  731. ls -la
  732. cd ..
  733. ls -la
  734. cd images/
  735. ls -la
  736. pwd
  737. ls -la
  738. ls /home/
  739. ls /home/LVM/
  740. ls /home/kvm-bak/vm-images/
  741. cd /home/kvm-bak/vm-images/
  742. ls -la
  743. qemu-img create -f raw SCM_add.img 160G
  744. ls -la
  745. pwd
  746. virsh edit test
  747. virsh --list
  748. virsh --help
  749. virsh list
  750. virsh attach-disk SCM-clone /home/kvm-bak/vm-images/SCM_add.img vdb cache none
  751. fdisk -l
  752. yum -y install libguestfs-tools
  753. ls /var/lib/libvirt/images/SCM.qcow2
  754. ls
  755. qemu-img info /var/lib/libvirt/images/SCM.qcow2
  756. qemu-img info /home/kvm-bak/vm-images/SCM_add.img
  757. ls -la
  758. qemu-img create -f qcow2 SCM_add.img 160G
  759. virsh edit SCM-clone
  760. qemu-img create -f qcow2 SCM_add.qcow2 160G
  761. ls -la
  762. rm -rf SCM_add.img
  763. ls -la
  764. rm -rf SCM_add.img
  765. virsh edit SCM-clone
  766. pwd
  767. ls -la
  768. clea
  769. clear
  770. history
  771. ls
  772. history > his.txt
  773. cat his.txt
  774. vi his.txt
  775. clear
  776. cat his.txt
  777. history
  778. history | cut -c -
  779. history | cut -c - > history

...

history中去除行号:

. 使用这个:
$ history | cut -c - . awk可以帮助:
history|awk '{$1="";print substr($0,2)}'
如果history很长这个可能会失败。 . 或者,你的sed:
history | sed 's/^[ ]*[0-9]\+[ ]*//'
使用别名,你可以设置这个作为你的标准(把它贴在你的bash_profile文件):
alias history="history | sed 's/^[ ]*[0-9]\+[ ]*//'" . history命令没有一个选项来禁止行号。你将不得不为每个人都在暗示: 例如:
history | cut -d' ' -f4- | sed 's/^ \(.*$\)/\1/g'

就目前而言,我基于一台机器,虚拟出了4台虚拟机,分别将其作为DevEnv、TestEnv、ScmEnv、ReleaseEnv;

目前看起来运行正常,后续如有运维或者修改需求,我在做更新和补充;

---------------------

HaoChuang @2018-04-17 10:20

后续远程维护,关于vnc的一点补充

查询vncserver状态
[root@localhost ~]# service vncserver status 查询vncserver服务
[root@localhost ~]# ps -ef | grep vnc [root@localhost ~]# ps -ef | grep vnc
root 18375 1 0 14:10 pts/4 00:00:00 /usr/bin/Xvnc :4 -auth /root/.Xauthority -desktop localhost.localdomain:4 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5904 -rfbwait 30000
root 18719 18207 0 14:11 pts/4 00:00:00 grep --color=auto vnc

参考如下信息:

[root@localhost ~]# vncserver

New 'localhost.localdomain:4 (root)' desktop is localhost.localdomain:4

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:4.log [root@localhost ~]# ping 192.168.0.202

看到这样之后,可以使用vnc viewer进行远程连接
输入对应的IP:port即可,像我的目前是192.168.1.200:5904,好了,截个图,需要的同学可以看看,长这姿势:

如果某些服务访问存在问题,需要考虑关闭防火墙即可

systemctl stop firewalld

  

HaoChuang @2018-05-22 14:42

有问题,可以联系我,为您提供支持,娃哈哈^_^

【原】【BG】-一次虚拟化环境实践简要记录的更多相关文章

  1. CentosX64使用yum快速搭建xen虚拟化环境

    Xen的大名想必已经被众SA所熟知.Xen 是一个开放源代码虚拟机监视器,由剑桥大学开发.它打算在单个计算机上运行多达100个满特征的操作系统.操作系统必须进行显式地修改(“移植”)以在Xen上运行( ...

  2. 在 CentOS 7上Virtualbox+phpVirtualBox完整虚拟化环境部署

    一.phpVirtualBox简介      VirtualBox是一套为不同操作系统而设的 x86 虚拟化产品.它是一个机器/硬件的虚拟化产品,功能上与 VMware Server.Parallel ...

  3. 基于OVS的VLAN虚拟化简易实践方案

    基于OVS的VLAN虚拟化简易实践方案 前言 本实验基于ovs的vlan流表匹配,根据端口进行vlan标签插入.手工配置ovs,使其具有vlan虚拟化方案. 实验拓扑 ---- ---- | h1 | ...

  4. 虚拟化环境下的CentOS7网络环境存在的问题

    http://dgd2010.blog.51cto.com/1539422/1592821/ 为什么要进行一次测试? 在使用CentOS7的过程中发现网络部分有很多与CentOS6所不同的地方. 1. ...

  5. kvm虚拟化学习笔记(一)之kvm虚拟化环境安装

    平时一直玩RHEL/CentOS/OEL系列的操作,玩虚拟化也是采这一类系统,kvm在RHEL6系列操作系统支持比较好,本文采用采用OEL6.3操作系统,网上所有文章都说KVM比xen简单,我怎么感觉 ...

  6. 记一次虚拟化环境下Windows IO性能的解析

    前言随着云计算技术与服务的发展和进步,越来越多的客户选择将业务部署到云端.但由于引入了虚拟化层,在业务部署过程中经常会遇到IO问题,通常也不易调试.本文主要介绍利用perf.systemtap等工具, ...

  7. kvm虚拟化环境的搭建

    首先搭建kvm的虚拟化环境,我选择的环境是在vmvare上的Centos 7的虚拟机,在该环境上搭建kvm的虚拟化环境 1:安装虚拟机(该过程自行安装) 2:操作系统环境的设置 (1)修改内核模式为兼 ...

  8. Django 虚拟化环境创建

    A:linux下的方法: 1.用python3.6内置的venv创建名为 typeidea-env虚拟化环境: python3.6 -m venv typeidea-env 2.激活环境: cd ty ...

  9. 第一章:ESXi6.7虚拟化环境安装

    1.1 硬件环境及镜像引导准备 1.1.1       硬件和系统资源 要安装ESXi6.7,硬件和系统资源必须满足下列要求: ESXi 6.7 要求主机至少具有两个 CPU 内核,生产环境中需要根据 ...

随机推荐

  1. 集合框架的类和接口均在java.util包中。 任何对象加入集合类后,自动转变为Object类型,所以在取出的时候,需要进行强制类型转换。

    集合框架的类和接口均在java.util包中. 任何对象加入集合类后,自动转变为Object类型,所以在取出的时候,需要进行强制类型转换.

  2. spring boot对输入的字符串进行html转码

    可以使用HtmlUtils这个类进行操作.具体的可以参考API,或者点出来看.

  3. 真探第一季/全集True Detective1迅雷下载

    真探 第一季 True Detective Season 1 (2014)真相如探 / 真爱如探本季看点:这部剧采用多视角叙事,伍迪·哈里森与马修·麦康纳饰演两名侦探搭档,他们一起调查一桩17年前的悬 ...

  4. Oracle初级性能优化总结

    前言 关于对Oracle数据库查询性能优化的一个简要的总结. 从来数据库优化都是一项艰巨的任务.对于大数据量,访问频繁的系统,优化工作显得尤为重要.由于Oracle系统的灵活性.复杂性.性能问题的原因 ...

  5. 详细解读DiskLruCache

    DiskLruCache这个类我记忆中是来自Google的一个开源项目,叫做BitmapFun,目的是更方便的加载bitmap.项目的源码:https://developer.android.com/ ...

  6. Host-Only模式

    Host-Only模式 在Host-Only模式下,虚拟网络是一个全封闭的网络,它唯一能够访问的就是主机.其实Host-Only网络和NAT网络很相似,不同的地方就是Host-Only网络没有NAT服 ...

  7. Http请求中Content-Type讲解以及在Spring MVC注解中produce和consumes配置详解

    原文地址:  https://blog.csdn.net/shinebar/article/details/54408020 引言: 在Http请求中,我们每天都在使用Content-type来指定不 ...

  8. MAT(Memory Analyzer Tool)内存分析工具的使用

    开发.应用中老是会遇到OutOfMemory异常,而且常常是过一段时间内存才被吃光,这里可以利用java heap dump出jvm内存镜像,然后再对其进行分析来查找问题. 平常利用jmap -dum ...

  9. Ubuntu 虚拟机安装几点细节整理

    虚拟机或者Wubi安装其实都挺简单的,这里还是再次总结下,给遇到麻烦的同学一点参考. 虚拟机安装 虚拟机直接通过新建-标准-选择镜像,Vmware能够自动识别镜像并进行Easy Install安装,E ...

  10. lazarus汉化

    启动Lazarus IDE,点击菜单栏中的Environment,再点击Options选项 在弹出的IDE选项框内,点选左侧Environment下的Desktop子选项,将Language设为Chi ...