目录
一、环境准备
主机 | IP |
Server端 | 192.168.133.40 |
Clienct端 | 192.168.133.41 |
二、Server端
2.1端创建共享目录并赋予其他人写的权限
mkdir /nfs
touch /nfs/hello.test
ls /nfs/
chmod -R 777 /nfs/
2.2下载安装包
#下载安装包
yum install -y nfs-utils rpcbind
2.3修改配置文件/etc/exports
注:ip地址为另一台机器的ip地址,非本机!
vim /etc/exports
/nfs 192.168.133.41(rw,no_root_squash,sync)
# 启动nfs服务并设置为开机自动启动服务
systemctl start nfs-server
systemctl enable nfs-server
三、Clienct端
3.0.1安装nfs文件系统
# 安装nfs文件系统
yum install -y nfs-utils
# 永久挂载目录
vim /etc/fstab
192.168.133.40:/nfs /mnt nfs defaults 0 0
mount -a
3.0.2查看是否挂载成功
3.0.3安装http、mariadb服务
yum install -y httpd mariadb-server mariadb
3.0.4启动httpd、mariadb服务,并设置成开机自启
[root@worker1 ~]# systemctl start httpd
[root@worker1 ~]# systemctl enable httpd
[root@worker1 ~]# systemctl start mariadb
[root@worker1 ~]# systemctl enable mariadb
3.0.5测试mariadb服务是否启动成功
3.0.6 将owncloud包拖拽到 Clienct 端虚拟机中的/mnt目录下解压
unzip owncloud-complete-20210326.zip
3.0.7修改/mnt目录下的所有文件的属主和属组为apache
chown -R apache:apache /mnt/
3.0.8更新yum源
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.0.9安装php软件包
yum install -y php72w php72w-opcache php72w-xml php72w-gd php72w-devel php72w-mysql php72w-intl php72w-mbstring
3.1.1创建httpd虚拟主机
vim /etc/httpd/conf.d/owncloud.conf
#ip地址为当前的主机IP
<VirtualHost 192.168.133.41:80>
ServerName owncloud.linux.com
DocumentRoot /mnt/owncloud
ErrorLog /var/log/httpd/vedio_error.log
CustomLog /var/log/httpd/vedio_access.log combined
</VirtualHost>
<Directory "/mnt">
Require all granted
</Directory>
# 查看语法是否有错
httpd -t
Syntax OK
#重启服务
systemctl restart httpd
3.1.2创建 owncloud数据库
MariaDB [(none)]> create database owncloud;
Query OK, 1 row affected (0.00 sec)
3.1.3nfs服务器授权用户可以登录服务器
MariaDB [(none)]> grant all on owncloud.* to own@192.168.133.40 identified by '1 23';
Query OK, 0 rows affected (0.00 sec)
#刷新授权表
MariaDB [owncloud]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
四、验证server端 是否可以登录数据库
4.1在nfs-server端安装数据库客户端
yum install -y mariadb-server
#测试链接
mysql -uown -p -h 192.168.133.41
4.2访问Clienct IP地址+/index.php