- 进入选择安装界面是修改配置信息
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
来源:oschina
链接:https://my.oschina.net/u/1179666/blog/811076