Linux精简版

(一)基础操作题

注:所有直接复制粘贴以我名字首字母命名部分出错后果自负 !

1、在系统中以自己名字首字母创建账号,该账号密码为123456,该账号所属组为hehe;创建hehecici账号,该账号密码为123456。

groupadd hehe
useradd pyw -g hehe
passwd pyw
useradd hehecici
passwd hehecici

2、在/root/hehe/haha目录下创建文件a和b,a文件内容为aaaaa,b文件内容为bbbbb,其中a的所有者和所属组为root:hehe,b的所有者和所属组为自己名字首字母账号:hehe。

mkdir -p hehe/haha
cd hehe/haha
vim a   
vim b
chown root:hehe a
chown pyw:hehe b

3、a文件所有者可读、可写、不可执行,所属组不可读、可写、可执行,其他人不可读、不可写、可执行。

chmod 631 a

4、b文件所有人不可读、不可写、不可执行。

chmod 0 b

5、复制b文件,复制后的文件名为c。

cp b c

(二)环境搭建

一、ftp环境搭建

1、创建帐号hehecici以及自己名字首字母的账号;
2、设置共享目录/root/hehe/haha
3、要求hehecici账号能够上传下载文件,自己名字首字母账号只能上传,不能下载

一、ftp环境搭建
yum install -y vsftpd
yum install -y ftp
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
grep -v "#" /etc/vsftpd/vsftpd.conf.bak > /etc/vsftpd/vsftpd.conf
systemctl stop firewalld
2.修改配置文件并创建hehecici以及自己名字首字母的帐号。
vim /etc/vsftpd/vsftpd.conf
<--以下为vsftpd的配置-->
anonymous_enable=NO
anon_umask=022
local_enable=YES
guest_enable=YES
guest_username=virtual
allow_writeable_chroot=YES
write_enable=YES
local_umask=022
local_root=/root/hehe/haha
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen_port=2231
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd.vu
userlist_enable=YES
tcp_wrappers=YES
user_config_dir=/etc/vsftpd/vusers_dir
pasv_min_port=45000
pasv_max_port=49000
------------------
vim /etc/vsftpd/vuser.txt
<--虚拟用户的账户名、密码列表-->
hehecici
123456
pyw
123456
------------------
db_load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db
chmod 600 /etc/vsftpd/vuser.db 
useradd -d /root/hehe/haha -s /sbin/nologin virtual
chmod -R 777 /root/hehe/haha/
vim /etc/pam.d/vsftpd.vu
<--建立支持虚拟用户的PAM认证文件-->
auth     required     pam_userdb.so  db=/etc/vsftpd/vuser
account  required     pam_userdb.so  db=/etc/vsftpd/vuser
---------------------------------------------------------
3.要求hehecici账号能够上传下载文件,自己名字首字母账号只能上传不能下载。
mkdir /etc/vsftpd/vusers_dir
vim /etc/vsftpd/vusers_dir/hehecici
<--hehecici的独立配置-->
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
---------------------------
vim /etc/vsftpd/vusers_dir/pyw
<--以自己名字首字母命名的配置-->
anon_upload_enable=YES
download_enable=NO
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
---------------------------
systemctl start vsftpd.service
4.演示
vim test.txt
ftp localhost 2231
	hehecici
	123456
	put test.txt
	get test.txt
	exit
-------------------
ftp localhost 2231
	pyw
	123456
	put test.txt
	get test.txt    
	exit
--------------------
//lcd /usr/tmp
[权限详细说明请参考文档](https://www.cnblogs.com/zhjh256/p/9155281.html)

二、samba环境搭建

1、安装samba,设置共享目录为/root/hehe/haha;
2、要求hehecici账号能够上传下载文件,自己名字首字母账号只能上传,不能下载。

1.安装samba
yum install -y samba
systemctl stop firewalld
systemctl start smb nmb 
yum install -y samba-client
2.创建共享目录及共享账号
mkdir -p /root/hehe/haha
smbpasswd -a hehecici
smbpasswd -a pyw
3.设置共享配置文件
vim /etc/samba/smb.conf
<--共享配置文件-->
[haha]
        comment = shared              
        path = /root/hehe/haha
        valid users = hehecici pyw
        write list = hehecici pyw
----------------------------------
4.查看共享目录设定权限并添加测试文件
ll -d /root/hehe/haha
chmod -R 777 /root
echo aaa > /root/hehe/haha/test.txt
systemctl restart smb nmb
(若进不去,可尝试 yum -y install cifs-utils)
5.挂载smb
mkdir /hehecici
mkdir /pyw
mount //172.17.118.210/haha /hehecici -o username="hehecici",password="123456"ip
mount //172.17.118.210/haha /pyw -o username="pyw",password="123456"
smbclient //172.17.118.210/haha -U hehecici
<--测试权限操作-->
put test.txt
get test.txt
exit
-------------
smbclient //172.17.118.210/haha -U pyw
<--测试权限操作-->
put test.txt
get test.txt
exit
-------------

三、搭建lamp环境

1.安装Apache
yum install -y httpd
2.安装Mysql57
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall -y mysql57-community-release-el7-8.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
set global validate_password_policy=0;
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
quit;
3.安装php70w
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm --nodeps --force
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w php70w-cli php70w-common php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-mbstring php70w-mysqlnd php70w-opcache php70w-pdo php70w-xml

四、框架搭建(一定看清上传的是文件夹还是文件夹内的文件,以下三个框架搭建均需搭建lamp环境

1.discuz

将文件解压到桌面至Discuz文件夹,将Discuz文件夹使用Xftp上传至/root目录下,将upload内文件复制到/var/www/html目录下
cp -rf /root/Discuz/upload/* /var/www/html
chmod -R 777 /var/www/html
systemctl restart mysqld
systemctl restart httpd
浏览器访问IP 39.106.82.8/install
安装完成后直接在浏览器用IP访问正确显示     

2.ecshop

将文件解压到桌面至ECShop文件夹,将ECShop文件夹使用Xftp上传至/root目录下,将appserver文件夹复制到/var/www 目录下,ecshop内文件复制到/var/www/html 目录下
cp -rf /root/ECShop/ECShop_V4.0.0_UTF8_release20190603/source/appserver/ /var/www
cp -rf /root/ECShop/ECShop_V4.0.0_UTF8_release20190603/source/ecshop/* /var/www/html/
chmod -R 777 /var/www/
systemctl restart httpd
systemctl restart mysqld
浏览器访问IP 39.106.82.8/install
安装完成后直接在浏览器用IP访问正确显示

3.wordpress

将文件解压到桌面至wordpress文件夹,将wordpress文件夹使用Xftp上传至/root目录下,将wordpress内文件复制到/var/www/html 目录下
cp -rf /root/wordpress/* /var/www/html/
chmod -R 777 /var/www/html
mysql -uroot -p
create database wordpress;
浏览器直接访问IP 39.106.82.8/wp-admin/install.php
安装完成后直接在浏览器用IP访问正确显示
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值