centos7 环境搭建
centos7 环境搭建
CentOS-7-x86_64-DVD-1511.iso
vmware12
1. 安装
使用iso安装系统;
2. 修改yum源到光盘
先把光盘CentOS-7-x86_64-DVD-1511.iso挂到vmware上,
to.dir yum.repo.d
vi CentOs-Media.repo
{
看到这么一行: file:///media/cdrom
}
mkdir -p /media/cdrom
lsblk
{
看到 sr0 4G ,知道是光盘
}
3. centos 7 默认开始没有配置网络,需要先安装基础工具
yum --disablerepo=\* --enablerepo=c7-media -y install vim net-tools
然后service network restart
ifconfig看网卡的ip还没出来。
cp /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eno16777736
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
++ HWADDR=00:0c:29:e1:dc:4f
TYPE=Ethernet
-+ BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=2b520f7d-5fbe-42c7-9a77-7d090a837aa6
DEVICE=eno16777736
-+ ONBOOT=yes
++ IPADDR0=192.168.2.109
++ PREFIXO0=24
++ GATEWAY0=192.168.2.1
++ DNS1=61.139.2.69
重启网络:
service network restart
或者systemctl restart network
GATEWAY0是路由器ip,设错了ping不通外网。
4. ssh远程登录ok,安装其他软件
yum --disablerepo=\* --enablerepo=c7-media -y install python ntp wget tree dos2unix
5. #关闭selinux和firewalld,配置网络
getenforce
setenforce 0
vi /etc/selinux/config
SELINUX=disabled
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
#重启network服务
systemctl restart network
6.使用阿里云repo
vi /etc/yum.repos.d/aliyun.repo
{
[base]
name=aliyun
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
}
yum clean all
yum update
7.配置时区和时间同步
tzselect
yum install -y ntpdate
#和服务器的时间差不能超过1天
ntpdate -d lin01.example.local
vi /etc/crontab
00 */1 * * * root /usr/sbin/ntpdate lin01.example.local;/sbin/hwclock -w
#手动设置时间
date -s 11/16/2015
date -s 18:28:00
hwclock -w
8.安装net-tools,查看启动的服务和端口
yum install -y net-tools
netstat -ntupl
9.关机,重启,取消操作
shutdown -P
shutdown -r
shutdown -c
reboot
10.关机前把数据从buffer写到磁盘确保完整性
sync
==================================================================
从11开始是开发使用一些扩展工具
yum install wget
11. samba
(1) install
yum --disablerepo=\* --enablerepo=c7-media -y install samba samba-client samba-common
service smb start
设置开机自启动
# chkconfig --level 35 smb on
(2)save config file
[root@localhost ~]# cp /etc/samba/smb.conf /etc/samba/smb.conf.origin
(3)modify config file
[root@localhost ~]# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
netbios name = CentOS7
server string = Samba Server
security = user
encrypt passwords = yes
max connections = 0
security = user
smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers
[jz2440]
path = /root/jz2440
writable = yes
guest ok = yes
write list = @root
validusers = @root
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936
(4)modify remote user name and passwd
[root@localhost ~]# touch /etc/samba/smbpasswd
[root@localhost ~]# smbpasswd -a root
(5) restart samba
[root@localhost ~]# service smb restart
(6) test samba on linux host
[root@localhost ~]# smbclient //127.0.0.1/jz2440
(7) some other command may be used
[root@localhost ~]# testparm ; 查看samba配置项
[root@localhost ~]# testparm -v -s | grep usershare ;查看samba详细的配置项, grep过滤字段.
[root@localhost ~]# systemctl stop firewalld.service ; 关闭防火墙
[root@localhost ~]# vi /etc/security/limits.conf ;设置用户可以同时打开的最大文件数, 等等等
[root@localhost ~]# ulimit -n 16384 ; 设置用户可以同时打开的最大文件数
#12. tftp
CentOS7 中TFTP配置 http://www.cnblogs.com/lion382/p/4266886.html
安装:
yum --disablerepo=\* --enablerepo=c7-media -y install tftp xinetd tftp-server
配置:
mkdir -p /root/jz2440/tftpboot
vi /etc/default/tftpd-hpa
{
server_args = -s /root/jz2440/tftpboot
}
启动:
service xinetd restart
13. nfs
Setting Up NFS Server And Client On CentOS 7
https://www.unixmen.com/setting-nfs-server-client-centos-7/
安装:
yum --disablerepo=\* --enablerepo=c7-media -y install nfs-utils
配置nfs:
mkdir -p /root/jz2440/nfs/fs_qtopia /root/jz2440/nfs/fs_mini_mdev
vi /etc/exports
{
/root/jz2440/nfs/fs_mini_mdev *(rw,sync,no_root_squash,no_subtree_check)
/root/jz2440/nfs/fs_qtopia *(rw,sync,no_root_squash,no_subtree_check)
}
启动nfs:
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server
systemctl restart nfs.service
测试nfs:
{
showmount -e
mkdir /var/nfs_share
mount -t nfs 192.168.2.109:/root/jz2440/nfs /var/nfs_share
ls /var/nfs_share/
fs_mini_mdev fs_qtopia
}
#14. vsftpd
centos7下配置vsftpd虚拟用户教程 http://www.cnblogs.com/mylinux/p/5621942.html
Linux中FTP的使用 http://blog.163.com/fankb222@126/blog/static/7117402320124743024279/
cmds:
service vsftpd restart
chkconfig --level 35 vsftpd on
steps:
安装:
yum -y install libdb-utils vsftpd ftp
chkconfig --level 35 vsftpd on
准备:
创建ftp各个虚拟server账户的目录:
mkdir -p /ftpserverdir/ocj /ftpserverdir/hl
chown -R ftpadmin:ocean /ftpserverdir/
chmod 775 -R /ftpserverdir
创建实际的ftp主用户:
#/usr/sbin/useradd -d /ftpserverdir -s /sbin/nologin ftpadmin
#passwd ftpadmin
为ftpadmin添加组属性:
usermod -G ocean ftpadmin //usermod -G <group> <usr_account>
配置vsftpd:
{
cd /etc/vsftpd/
[root@localhost vsftpd]# vi /etc/vsftpd/chroot_list
ftpadmin
[root@localhost vsftpd]# vi /etc/vsftpd/vftpuser.txt
ocj
1
hl
1
[root@localhost vsftpd]# cat /etc/vsftpd/vuser_conf/ocj
local_root=/ftpserverdir/ocj
write_enable=YES
download_enable=YES
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
local_umask=022
listen_port=21
[root@localhost vsftpd]# cat /etc/vsftpd/vuser_conf/hl
local_root=/ftpserverdir/hl
write_enable=YES
download_enable=YES
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
local_umask=022
listen_port=21
[root@localhost vsftpd]# cat /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
chroot_local_user=YES
guest_enable=YES
guest_username=ftpadmin
virtual_use_local_privs=YES
chmod_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
chroot_list_enable=YES
user_config_dir=/etc/vsftpd/vuser_conf
allow_writeable_chroot=YES
}
配置好了之后:
setsebool ftpd_disable_trans 1 或 setsebool -P ftp_home_dir on 或 setsebool -P ftpd_disable_trans on
service vsftpd restart
abnormal:
ftp服务 500 OOPS:cannot change directory:/root
{
1、setsebool -P ftp_home_dir on 或 setsebool -P ftpd_disable_trans on
service vsftpd restart
2、关闭 selinux
修改/etc/selinux/config文件
设置SELINUX= disabled
}
vsftp 无法启动,500 OOPS: bad bool value in config file for: anonymous_enable
{
http://www.cnblogs.com/chen110xi/p/3717652.html
可能原因是配置文件格式不对
解决方法: 配置文件转码dos2unix /etc/vsftpd/vsftpd.conf
}
==================================================================
参考:
centos 7安装后初始化配置
http://www.aichengxu.com/view/10933283
centos7 环境搭建的更多相关文章
- ELK日志分析平台系统CentOS7环境搭建和基本使用
一.搭建环境 系统环境:CentOS7 安装iptables:https://blog.csdn.net/momo_mutou/article/details/81739155 jdk1.8: ht ...
- Linux系统:Centos7环境搭建Redis单台和哨兵集群环境
本文源码:GitHub·点这里 || GitEE·点这里 一.环境和版本 Linux:centos7 三台 三台Linux服务 192.168.72.129 192.168.72.130 192.16 ...
- Centos7环境搭建lnmp环境
[原创]编译安装lnmp环境 准备软件:nginx1.10.3+php-5.5.12+mariadb10.0.8(数据库在此使用的yum安装) 如果需要编译安装的可以给我留言,我后续再发布出来! 依赖 ...
- centos7环境搭建Eureka-Server注册中心集群
目的:测试和线上使用这套独立的Eureka-Server注册中心集群,目前3台虚拟机集群,后续可直接修改配置文件进行新增或减少集群机器. 系统环境: Centos7x64 java8+(JDK1.8+ ...
- centos7环境搭建一台mysql服务器启动多个端口
在一台服务器上启动多个mysql实例,分别用不同的端口号,因centos7版本安装mysql5.7后不存在mysqld_multi .mysqld_safe等命令,做踩坑总结 Mysql多实例实现的3 ...
- Linux Centos7 环境搭建Docker部署Zookeeper分布式集群服务实战
Zookeeper完全分布式集群服务 准备好3台服务器: [x]A-> centos-helios:192.168.19.1 [x]B-> centos-hestia:192.168.19 ...
- 虚拟机centos7环境搭建,系统分区,静态IP配置
文章目录 1.虚拟机安装centos7 2.系统分区 3.配置静态IP centos7下载地址 http://mirrors.aliyun.com/centos/7/isos/x86_64/ Cent ...
- centos7环境搭建命令List
npm -ivh jdk-8u191-linux-x64.rpm adduser sai passwd sai whereis sudoers vim /etc/sudoers rpm -qa | g ...
- centos7环境搭建
1. tar命令安装 yum install -y tar 2. jdk8下载 wget --no-check-certificate --no-cookies --header "Cook ...
随机推荐
- 权威验证:MSDN会明确告诉你下载的光盘镜像是否正宗微软原版
MSDN是微软官方网站.这个网站的职能之一,就是向MSDN订户(付费相当高昂)提供Microsoft Windows资源,即大家通常说的操作系统光盘镜像.相信大家手头都有不少这类下载,但究竟是否微软的 ...
- https://repo1.maven.org/maven2/com/github/,开源软件清单list
Index of /maven2/com/github/ ../ 0312birdzhang/ 26-Jun-2015 07:21 - 120011676/ 22-Mar-2016 11:16 - 1 ...
- 柯南君:看大数据时代下的IT架构(6)消息队列之RabbitMQ--案例(Publish/Subscribe起航)
二.Publish/Subscribe(发布/订阅)(using the Java Client) 为了说明这个模式,我们将构建一个简单的日志系统.它将包括两个项目: 第一个将发出日志消息 第二个将接 ...
- DELL服务器安装Windows server 2003---解决找不到安装在计算机上的硬盘驱动器 安装无法
安装Windows server 2003系统,本以为改改BIOS配置“改为从光驱启动优先”很容易搞定的.没想到系统安装过程中碰到“找不到安装在计算机上的硬盘驱动器安装无法继续,要退出请按F3”问题, ...
- 【HTML5】DOMContentLoaded事件
这个事件是从HTML中的onLoad的延伸而来的,当一个页面完成加载时,初始化脚本的方法是使用load事件,但这个类函数的缺点是仅在所有资源都完全加载后才被触发,这有时会导致比较严重的延迟,开发人员随 ...
- python第三天---collections类
collection系列 1.计数器(counter) Counter是对字典类型的补充,用于追踪值的出现次数. 我们从中挑选一些相对常用的方法来举例: 在上面的例子我们可以看出,counter方法返 ...
- Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码 题目描写叙述: A Binary Search Tree (BST) is recursively defined as a binary tree which has the f ...
- MongoDB 启动异常
今天启动MongoDB遇到异常状况 mongodb warning: 32-bit servers don't have journaling enable 解决方法: 删除数据库目录的.lock文件 ...
- jquery JS 左右方向键
$(function (){ // $(document).keydown(function(e){ var code=e.which; switch (code) { case 38: //上 br ...
- 简述sprintf、fprintf和printf函数的区别
都是把格式好的字符串输出,只是输出的目标不一样:1 printf,是把格式字符串输出到标准输出(一般是屏幕,可以重定向).2 sprintf,是把格式字符串输出到指定字符串中,所以参数比printf多 ...