CentOS 7 笔记

主机名:hostnamectl set-hostname dlp.server.world
查看系统版本:cat /etc/issue
查看内核版本:uname -a

安装源
http://mirrors.163.com/centos/7/os/x86_64/
cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo.bak
# wget http://mirrors.163.com/.help/CentOS-Base-163.repo
# yum makecache

远程连接ssh要把selinux关闭
# /usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
# setenforce 0                  ##设置SELinux成为permissive模式(临时关闭)
# setenforce 1                  ##设置SELinux成为enforcing模式
修改/etc/selinux/config文件(或者/etc/sysconfig/selinux),将SELINUX=enforcing改为SELINUX=disabled,重启。
# sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
# vi /etc/ssh/sshd_config
Port 22222
Protocol 2
ServerKeyBits 1024
# service sshd start

yum update 更新时不升级内核
# vi /etc/yum.conf
在 [main] 的最后添加 exclude=kernel*,或者
# yum --exclude=kernel* update

删除多余内核
# uname -a
# rpm -qa | grep kernel
#yum remove kernel-2.6.32-71.el6.i686
#yum remove kernel-devel-2.6.32-71.el6.i686

samba要把selinux关闭
# yum install samba samba-client
# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# vi /etc/samba/smb.conf     ##具体选项查询man
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = no
printcap name = /dev/null
若没有打印机,则需要添加这两行,否则日志中会有错误:
Unable to connect to CUPS server localhost:631 - No such file or directory
failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
# mkdir -p /var/samba/bangs
# mkdir -p /var/samba/share
# useradd -d /var/samba/bangs -s /sbin/nologin bangs -g smbuser
# passwd bangs
# smbpasswd -a bangs     ##smbpasswd需要samba-client软件包
standard input is not a socket, assuming-D option
# vi /etc/sysconfig/samba
SMBDOPTIONS="-D"
# systemctl enable smb.service
# systemctl restart smb.service
# systemctl enable nmb.service
# systemctl restart nmb.service
# systemctl status smb.service
# systemctl stop firewalld.service          ##关闭 Firewall
# systemctl disable firewalld.service      ##预设不启动 Firewall
# setenforce 0
方法二是添加规则
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload
Windows中映射
net use * /del
net use z: /delete /yes
net use z: \\192.168.1.1\bangs bangs /user:bangs /persistent:no
control userpasswords2




你可能感兴趣的:(linux)