프로젝트 9
安装&放行 samba服务
yum install -y samba
systemctl enable --now smb
firewall-cmd --add-service=samba --permanent
firewall-cmd --reload
firewall-cmd --list-services
创建根共享目录
mkdir /DocRoot
cd /DocRoot/
mkdir -p 管理部/{对外,公共,受控}
mkdir -p 财务部/{对外,公共,受控}
mkdir -p 制造部/{对外,公共,受控}
mkdir 公共区
mkdir 交换区
共享根目录
vim /etc/samba/smb.conf
添加:
[公司文档]
path=/DocRoot
writable=yes
public=yes
cat /etc/samba/smb.conf
创建用户
vim MyUserTool.sh (创建一个脚本方便创建用户)
#!/bin/bash
for groupName in {glb,cwb,zzb,leader};do
groupadd ${groupName}
for i in {01..03};do
useradd -s /sbin/nologin ${groupName}${i} -g ${groupName} && echo "添加${groupName}${i}成功"
echo -e "123\n123" | smbpasswd -a ${groupName}${i} -s
done
done
#网络部组和用户
groupadd netb
for i in {01..02};do
useradd -s /sbin/nologin netb${i} -g netb && echo "添
加netb${i}成功"
echo -e "123\n123" | smbpasswd -a netb${i} -s
done
#公共区域、交换区域
groupadd pub
groupadd exchange
运行脚本
sh MyUserTool.sh
给各部门配置权限
chmod 1777 /DocRoot/交换区
chmod 700 /DocRoot/财务部/受控/
chown cwb01:cwb /DocRoot/财务部/受控
setfacl -m u:leader01:rx /DocRoot/cau
setfacl -m u:leader01:rx /DocRoot/财务部/受控/
setfacl -m u:leader03:rx /DocRoot/财务部/受控/
chmod 755 /DocRoot/财务部/对外
chown cwb02:cwb /DocRoot/财务部/对外
chown cwb02:cwb /DocRoot/财务部/公共
chmod 755 /DocRoot/财务部/公共
chmod 700 /DocRoot/管理部/受控
chown glb01:glb /DocRoot/管理部/受控
setfacl -m u:leader01:rx /DocRoot/管理部/受控
chmod 755 /DocRoot/管理部/对外
chown glb02:glb /DocRoot/管理部/对外
chmod 755 /DocRoot/
chmod 777 /DocRoot/
chmod 755 /DocRoot/管理部/公共
chown glb02:glb /DocRoot/管理部/公共
chmod 755 /DocRoot/公共区/
setfacl -m g:netb:rwx /DocRoot/公共区/
systemctl reload smb
chcon -R -t samba_share_t /DocRoot
setsebool -P samba_enable_home_dirs on
yum provides semanage
semanage fcontext -a -t samba_share_t '/DocRoot(/.*)?'
restorecon -Rv /DocRoot/
setfacl -m other::--- /DocRoot/财务部/受控/
setfacl -m other::--- /DocRoot/制造部/受控/
setfacl -m other::--- /DocRoot/管理部/受控/
setfacl -m other::--- /DocRoot/管理部/公共/
setfacl -m other::--- /DocRoot/制造部/公共/
setfacl -m other::--- /DocRoot/财务部/公共/
setfacl -m g:leader:r-x /DocRoot/管理部/受控/
setfacl -m g:leader:r-x /DocRoot/财务部/受控/
setfacl -m g:leader:r-x /DocRoot/制造部/受控/
setfacl -m u:leader01:rx /DocRoot/财务部/受控
setfacl -m u:leader03:rx /DocRoot/制造部/受控
chown glb01 /DocRoot/管理部/受控
chown zzb01 /DocRoot/制造部/受控/
chown zzb02 /DocRoot/制造部/公共/
chown cwb02 /DocRoot/财务部/公共/
chown glb02 /DocRoot/管理部/公共/
最后在管理部的公共文件夹下创建test.txt
---------------------------------------------------------------------------------------------------------------------------------
프로젝트 12
1.安装nginx
yum install nginx -y
2.安装mariadb
yum install mariadb-server -y
systemctl start mariadb //启动mariadb
mysql_secure_installation //为新安装的MariaDB配置安全环境
3.安装PHP
yum install php -y
1.下载安装包
yum install wget -y
wget https://gitee.com/Discuz/DiscuzX/attach_files/1543382/download -O discus.zip
yum install unzip
unzip discus.zip -d _tmp
3.移动网站文件到apache根
cd _tmp
mv upload/ /usr/share/nginx/html/bbs
服务开机启动
systemctl enable nginx.service
systemctl enable mariadb.service
systemctl start nginx.service
systemctl start mariadb.service
防火墙
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=mysql --permanent
firewall-cmd --reload
为mariadb管理员账号加密码
mysqladmin -uroot -p123 password "sziit"
从浏览器端启动Discuz安装配置程序
http://192.168.25.129/bbs/install
解决文件权限问题
#编辑目录列表文件
setenforce 0
在/usr/share/nginx/html/bbs下
vim dir.list
for dir in $(cat dir.list);do chmod o+w $dir;done
#解决mysqli_connect()不支持故障
yum install php-mysqlnd php-xml php-json -y
#重启nginx、mariadb
systemctl restart nginx.service
systemctl restart mariadb.service
1.解决网站文件上下文标签问题
yum provides semanage
yum install -y ......
semanage fcontext -a -t httpd_sys_content_t '/usr/share/nginx/html/bbs(/.*)?'
restorecon -Rv /usr/share/nginx/html/bbs
2.解决httpd数据库连接问题
getsebool -a | grep http | grep db
setsebool httpd_can_network_connect_db on
3.解决目录写权限问题
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/bbs/data/template(/.*)?'
restorecon -Rv /usr/share/nginx/html/bbs/data/template
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/bbs/data'
restorecon -Rv /usr/share/nginx/html/bbs/data
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/bbs/data/sysdata(/.*)?'
restorecon -Rv /usr/share/nginx/html/bbs/data/sysdata
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/bbs/data/cache(/.*)?'
restorecon -Rv /usr/share/nginx/html/bbs/data/cache
1.安装
wget https://cn.wordpress.org/latest-zh_CN.zip
unzip latest-zh_CN.zip -d wordpress
cd wordpress
mv wordpress/ /usr/share/nginx/html/wordpress
访问页面 setenforce 0
2.创建数据库
mysql -uroot -psziit
create database wordpress;
show databases;
grant all on wordpress.* to 'wordpress'@'%localhost' identified by 'sziit';
setsebool httpd_can_network_connect_db on
3.解决目录写权限问题
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/wordpress/(/.*)?'
改好之后,进入网页版
在/usr/share/nginx/html/bbs下删除需要删除的两项
再在<管理中心>→<板块管理>→<论坛>→<添加新板块>→test99
刷新后进入test99,标题testpage99,内容随意发送帖子