- 進入選擇安裝界面是修改配置信息
U盤安裝出現錯誤:
dracut-initqueue[624]:Warning: Could not boot.
dracut-initqueue[624]:Warning: /dev/root does not exist.
Starting Dracut EmergencyShell
Warning: /dev/root does not exist
dracut:/#
dracut:/# cd dev
dracut:/# ls
dracut:/# ls|grep sdb
sdb sdb4
#或則改成:vmlinuz initrd=initrd.img linux dd quiet 而後查看是哪一個是安裝盤
(第一個install安裝界面)tab鍵顯示設置信息,修改指定U盤設置號
vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet
改成:
vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdb4 quiet
Tab 鍵不行,使用e鍵:
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CENTOS7 quiet
改成:linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:/dev/sdb4 quiet
ctrl+x退出
- 安裝第一基礎盤系統(無界面,幾乎無任何軟件,yum已安裝,安裝前界面設置獲取到網絡)默認選中
必需分區
/ (根分區)
swap分區 (交換分區,內存的兩倍,物理內存不超過4G,使用2倍,超過使用物理內存大小)
(物理內存不夠用,會使用交換分區)
推薦分區
/boot (啓動分區,200M)(我安裝分配500mb)
可在安裝界面設置固定IP(系統->網絡或主機)
- 安裝ifconfig
yum search ifconfig
yum install -y net-tools.x86_64
service sshd start #啓動
rpm -ql 包名 #查看安裝位置
[root@localhost sbin]# rpm -ql net-tools.x86_64
/bin/netstat
/sbin/arp
/sbin/ether-wake
/sbin/ifconfig
/sbin/ipmaddr
/sbin/iptunnel
/sbin/mii-diag
/sbin/mii-tool
/sbin/nameif
/sbin/plipconfig
/sbin/route
/sbin/slattach
/usr/lib/systemd/system/arp-ethers.service
/usr/share/doc/net-tools-2.0
/usr/share/doc/net-tools-2.0/COPYING
/usr/share/locale/cs/LC_MESSAGES/net-tools.mo
/usr/share/locale/de/LC_MESSAGES/net-tools.mo
/usr/share/locale/et_EE/LC_MESSAGES/net-tools.mo
/usr/share/locale/fr/LC_MESSAGES/net-tools.mo
/usr/share/locale/pt_BR/LC_MESSAGES/net-tools.mo
/usr/share/man/de/man5/ethers.5.gz
/usr/share/man/de/man8/arp.8.gz
/usr/share/man/de/man8/ifconfig.8.gz
/usr/share/man/de/man8/netstat.8.gz
/usr/share/man/de/man8/plipconfig.8.gz
/usr/share/man/de/man8/route.8.gz
/usr/share/man/de/man8/slattach.8.gz
/usr/share/man/fr/man5/ethers.5.gz
/usr/share/man/fr/man8/arp.8.gz
/usr/share/man/fr/man8/ifconfig.8.gz
/usr/share/man/fr/man8/netstat.8.gz
/usr/share/man/fr/man8/plipconfig.8.gz
/usr/share/man/fr/man8/route.8.gz
/usr/share/man/fr/man8/slattach.8.gz
/usr/share/man/man5/ethers.5.gz
/usr/share/man/man8/arp.8.gz
/usr/share/man/man8/ether-wake.8.gz
/usr/share/man/man8/ifconfig.8.gz
/usr/share/man/man8/ipmaddr.8.gz
/usr/share/man/man8/iptunnel.8.gz
/usr/share/man/man8/mii-diag.8.gz
/usr/share/man/man8/mii-tool.8.gz
/usr/share/man/man8/nameif.8.gz
/usr/share/man/man8/netstat.8.gz
/usr/share/man/man8/plipconfig.8.gz
/usr/share/man/man8/route.8.gz
/usr/share/man/man8/slattach.8.gz
/usr/share/man/pt/man8/arp.8.gz
/usr/share/man/pt/man8/ifconfig.8.gz
/usr/share/man/pt/man8/netstat.8.gz
/usr/share/man/pt/man8/route.8.gz
- 配置網絡
centos7取消了ifconfig命令,使用ip addr命令查看IP地址
找到以太網卡配置文件ifcfg-enp**文件,過面的數字好像是隨機生成的。
/etc/sysconfig/network-scripts/
使用Root打開並編輯些文件,將onboot的"no"改成「yes」,而後重啓網絡。
最後輸入:wq 保存並退出,再重啓一下network:
3.重啓網絡命令
# service network restart
這樣再啓動系統時,網絡也會自動啓動。
# 查看網卡UUID
# nmcli con show
- 安裝ssh
yum search sshd
yum install -y openssh-server.x86_64
service sshd start #啓動
chkconfig sshd on #設置開機運行
- 安裝setup
yum install setuptool
centos7 改成 nmtui 設置IP
- 安裝zip unzip
yum install -y zip unzip
- 安裝wget
yum install -y wget
- JDK安裝(rpm包)
[root@localhost install]# rpm -ivh jdk-8u111-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jdk1.8.0_111-2000:1.8.0_111-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
- 關閉firewall防火牆,安裝iptables防火牆(centos7,默認使用firewall)
關閉firewall:
systemctl stop firewalld.service #中止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
安裝iptables防火牆
yum install iptables-services #安裝
vi /etc/sysconfig/iptables #編輯防火牆配置文件
systemctl restart iptables.service #最後重啓防火牆使配置生效
systemctl enable iptables.service #設置防火牆開機啓動
[iptables設置詳解](https://my.oschina.net/u/1179666/blog/533473)
關閉SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #註釋掉
#SELINUXTYPE=targeted #註釋掉
SELINUX=disabled #增長
:wq! #保存退出
setenforce 0 #使配置當即生效
- 安裝時區同步
[root@localhost ~]# yum install -y ntp #安裝ntp服務的軟件包
[root@localhost ~]# systemctl enable ntpd #將ntp服務設置爲缺省啓動
vi /etc/sysconfig/ntpd #修改啓動參數,增長-g -x參數,容許ntp服務在系統時間偏差較大時也能正常工做
service ntpd restart #啓動ntp服務
[root@localhost ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#將系統時區改成上海時間 (亦即CST時區)
- 安裝ftp服務端
yum -y install vsftpd
vi /etc/vsftpd/vsftpd.conf #配置文件
systemctl enable vsftpd.service #設置vsftpd開機啓動
#啓動並查看vsftpd服務狀態,systemctl啓動服務成功不會有任何提示,綠色的active表示服務正在運行
systemctl start vsftpd.service
systemctl status vsftpd.service
- 安裝gcc
[root@localhost ~]# yum -y install gcc
[root@localhost ~]# yum -y install gcc-c++
- 安裝boost
#yum安裝,安裝的版本是1.53.0,mysql5.7須要boost_1_59_0
yum -y install boost
yum -y install boost-devel
yum -y install boost-doc
rpm -qa boost* #查看yum安裝的boost
yum -y remove boost-* #卸載舊的boost
#源碼安裝
wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
#mysql5.7須要,不能高也不低
[root@localhost boost_1_59_0]# ./bootstrap.sh --prefix=/usr/local/boost
[root@localhost boost_1_63_0]# ./b2 install
#
- ncurses安裝
ncurses下載地址:http://www.gnu.org/software/ncurses/
./configure
make
make install
------------------------------------------ yum 安裝 ------------------------
yum install ncurses-devel
- rc.local開機不執行
[root@localhost ~]# ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 Mar 16 16:09 /etc/rc.local -> rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local
-rw-r--r--. 1 root root 609 Mar 17 09:31 /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
- 安裝tomcat
groupadd tomcat #建立tomcat用戶組
useradd -d /usr/tomcat -g tomcat -m tomcat #建立tomcat用戶
passwd tomcat #設置tomcat密碼
[tomcat@localhost install]$ tar -zxvf apache-tomcat-7.0.39.tar.gz
[tomcat@localhost install]$ cp apache-tomcat-7.0.39 ../tomcat
[root@localhost ~]# vi /etc/sysconfig/ntpd 修改啓動參數,增長-g -x參數,
容許ntp服務在系統時間偏差較大時也能正常工做
#配置開機啓動
[root@localhost etc]# vi /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
su - tomcat -c /usr/tomcat/tomcat/bin/startup.sh #用戶tomcat帳戶啓動tomcat
#centos7 rc.local作成服務了
[root@localhost rc.d]# systemctl enable rc-local.service #使有效
[root@localhost ~]# systemctl status rc-local.service #查看狀態
[root@localhost ~]# ls -ls /etc/rc.d/rc.local
4 -rw-r--r--. 1 root root 554 Dec 26 01:37 /etc/rc.d/rc.local
[root@localhost ~]# chmod +x /etc/rc.d/rc.local
[root@localhost ~]# ls -ls /etc/rc.d/rc.local
4 -rwxr-xr-x. 1 root root 554 Dec 26 01:37 /etc/rc.d/rc.local
- 安裝Nexus
groupadd nexus #建立nexus用戶組
useradd -d /usr/nexus -g nexus -m nexus #建立nexus用戶
passwd nexus #設置nexus密碼
[root@localhost ~]# vi /etc/rc.local
touch /var/lock/subsys/local
su - tomcat -c /usr/tomcat/tomcat/bin/startup.sh #用tomcat帳戶啓動tomcat
su - nexus -c /usr/nexus/nexus/nexus-2.11.0-02/bin/nexus.sh #用nexus帳戶啓動nexus
#單獨寫nexus.sh 執行 nexus start,su - nexus -c 執行命令不能 有空格,空格後的命令不執行,例start不執行
- 安裝nginx
groupadd nginx #建立nginx用戶組
useradd -d /usr/nginx -g nginx -m nginx #建立nginx用戶
passwd nginx #設置nginx密碼
[nginx@localhost install]$ tar -xzvf nginx-1.10.2.tar.gz
[nginx@localhost nginx-1.10.2]$ ./configure --prefix=/usr/nginx/nginx
#啓用SSL支持(可以配置HTTPS)
[nginx@localhost nginx-1.10.2]$ ./configure --prefix=/usr/nginx/nginx --with-http_ssl_module
[nginx@localhost nginx-1.10.2]$ make
[nginx@localhost nginx-1.10.2]$ make install
[nginx@localhost sbin]$ ./nginx
[nginx@localhost sbin]$ ./nginx -s stop
[root@localhost nginx-1.10.2]# yum -y install openssl openssl-devel
#安裝Nginx時報錯
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
#安裝pcre-devel解決問題
yum -y install pcre-devel
#安裝Nginx時報錯
./configure: error: the HTTP gzip module requires the zlib library.
yum install -y zlib-devel
#1024下的端口須要root用戶啓動,使用root帳戶啓動nginx
#nginx 啓動報錯:
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
#root 用戶啓動 修改nginx.conf,第一行添加user root; 不添加啓動成功後訪問頁面會報403錯誤;
#啓動文件目錄:/usr/nginx/nginx/sbin
#配置ngnix.conf 的https(SSL):
server {
listen 443;
server_name localhost;
ssl on; #開啓ssl
ssl_certificate /root/tmp/server.crt; #證書位置
ssl_certificate_key /root/tmp/server.key; #私鑰位置
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1; #指定密碼爲openssl支持的格式
ssl_ciphers HIGH:!aNULL:!MD5; #密碼加密方式
ssl_prefer_server_ciphers on; #依賴SSLv3和TLSv1協議的服務器密碼將優先於客戶端密碼
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/nginx/html; #根目錄
index index.html index.htm;
}
}
- 安裝mysql
groupadd mysql#建立mysql用戶組
useradd -d /usr/mysql -g mysql -m mysql#建立mysql用戶
passwd mysql#設置mysql密碼
[具體安裝方法](https://my.oschina.net/u/1179666/blog/495272(博客:Mysql數據庫安裝))
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.7/mysql-5.7.16.tar.gz
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=0 -DWITH_BOOST=/usr/mysql/install #-DDOWNLOAD_BOOST=0不下載,boost源碼位置在/usr/mysql/install下
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/mysql/install #會下載boost在/usr/mysql/install 目錄下,mysql 5.7只能1.59.0,高版本、低版本都不行
- docker安裝
groupadd docker #建立docker用戶組
useradd -d /usr/docker -g docker -m docker#建立docker用戶
passwd docker#設置docker密碼
[root@localhost ~]# yum -y install docker-io #安裝docker
[root@localhost ~]# service docker start #啓動(舊語法,centos7之前的語法)
[root@localhost ~]# chkconfig docker on #開機啓動(舊語法,centos7之前的語法)
[root@localhost ~]# systemctl start docker.service #啓動(新語法,centos7新引入的語法)
[root@localhost ~]# systemctl enable docker.service #設置開機自啓動(新語法,centos7新引入的語法)
[root@localhost ~]# docker version #查看docker版本
Client:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.3
API version: 1.22
Package version: docker-common-1.10.3-59.el7.centos.x86_64
Go version: go1.6.3
Git commit: 3999ccb-unsupported
Built: Thu Dec 15 17:24:43 2016
OS/Arch: linux/amd64