day09 samba、nginx服务配置

时间:2023-03-09 17:04:20
day09 samba、nginx服务配置

samba

1.环境准备

[root@localhost ~]# iptables -F                           #清除防火墙配置
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
[root@localhost ~]# setenforce #关闭策略组,临时
[root@localhost ~]# vim /etc/sysconfig/selinux            #文件中关闭策略组
[root@localhost ~]# systemctl status firewalld #查看防火墙状态

2.安装软件包

[root@localhost ~]# yum -y install samba                  #yum 安装samba

3.修改配置配置

[root@localhost ~]# vim /etc/samba/smb.conf         #修改 samba 配置文件
         [public]
comment = Public Stuff
path = /home/samba
public = yes
writable = yes
printable = no
write list = +staff
[root@localhost ~]# mkdir /home/samba               #创建 public 公共目录

增加用户

[root@localhost ~]# smbpasswd -a jack     # 用户名一定要是系统用户
New SMB password:
Retype new SMB password:
Added user jack.

补充知识

vim /etc/hosts      写入一条关于本地解析的命令
hostname 查看本机名
hostname set-hostname 设置主机名
增加samba链接的速度

vim /etc/ssh/sshd_config //UseDNS 改成no
  systemctl restart sshd
  增加xshell连接速度

4.启动服务

[root@localhost ~]# systemctl start smb

5.测试

day09 samba、nginx服务配置day09 samba、nginx服务配置

nginx

1.准备环境

[root@localhost ~]# iptables -F                           #清除防火墙配置
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
[root@localhost ~]# setenforce 0 #关闭策略组,临时
[root@localhost ~]# vim /etc/sysconfig/selinux            #文件中关闭策略组
[root@localhost ~]# systemctl status firewalld #查看防火墙状态
[root@bogon ~]# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
# 安装依赖库

2.安装软件包
2.1 从 http://nginx.org/download/nginx-1.12.0.tar.gz 下载 nginx 的 压缩包

[root@bogon ~]# wget http://nginx.org/download/nginx-1.12.0.tar.gz -P /root/Downloads/
# 从网上下载 nginx 压缩的源码文件,保存路径为 /root/Downloads/
[root@bogon ~]# cd /root/Downloads/                       #进入下载目录
[root@bogon Downloads]# ll #查看所有文件
总用量 17444
-rw-r--r--. 1 root root 980831 Apr 12 08:11 nginx-1.12.0.tar.gz
drwxr-xr-x. 18 501 501 4096 May 28 19:23 Python-3.6.1
-rw-r--r--. 1 root root 16872064 Mar 21 00:47 Python-3.6.1.tar.xz
[root@bogon Downloads]# tar xzf nginx-1.12.0.tar.gz # 解压
[root@bogon Downloads]# cd nginx-1.12.0/ #进入解压好的nginx文件
[root@bogon nginx-1.12.0]# mkdir /usr/local/nginx #创建存放文件目录
[root@bogon nginx-1.12.0]# ./configure --prefix=/usr/local/nginx #执行文件并放到存放文件目录
[root@bogon nginx-1.12.0]# make && make install #编译,安装

4.启动服务

[root@bogon nginx-1.12.0]# /usr/local/nginx/sbin/nginx

5.测试

在网页中输入服务端的ip地址