首页 > 系统相关 >centos7 LAMP部署owncloud

centos7 LAMP部署owncloud

时间:2024-01-24 17:31:46浏览次数:21  
标签:mariadb ## centos7 LAMP owncloud yum php root localhost

部署LAMP

1.安装 Apache

[root@localhost ~]# yum install httpd -y

2、启动 Apache 并设置为开机自启动

## 启动Apache

[root@localhost ~]# systemctl start httpd

\## 设置开机自启

[root@localhost ~]# systemctl enable httpd

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to

/usr/lib/systemd/system/httpd.service.

3、查看Apache当前端口

## 安装netstat命令用于查看端口

[root@localhost ~]# yum install net-tools -y

[root@localhost ~]# netstat -antlupe | grep httpd

tcp6 0 0 :::80 :::* LISTEN 0

24654 2008/httpd

4、防火墙配置

[root@localhost ~]# firewall-cmd --permanent --add-service=http
success
## 允许80号端口永久通过防火墙
[root@localhost ~]# firewall-cmd --permanent --add-port=80/tcp
success
## 重新加载防火墙
[root@localhost ~]# firewall-cmd --reload
success

5、测试

浏览器中输入 http://IP地址:端口号

出现这个页面就代表服务部署成功


部署MySQL

这里我用MariaDB来替代

检查环境有没有旧版Mariadb旧版本

[root@localhost ~]# rpm -qa | grep -i mariadb
mariadb-libs-5.5.56-2.el7.x86_64
## 有的话删除旧版本Mariadb
[root@localhost ~]# yum remove mariadb-libs -y
1、配置阿里云mariadb YUM仓库

[root@localhost ~]# cd /etc/yum.repos.d

[root@localhost yum.repos.d]# vi mariadb.repo

# MariaDB 10.11 CentOS repository list - created 2023-11-01 09:12 UTC

# https://mariadb.org/download/

[mariadb]

name = MariaDB

# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See

https://mariadb.org/mirrorbits/ for details.

# baseurl = https://rpm.mariadb.org/10.11/centos/$releasever/$basearch

baseurl = https://mirrors.aliyun.com/mariadb/yum/10.11/centos/$releasever/$basearch

module_hotfixes = 1

\# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB

gpgkey = https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB

gpgcheck = 1

更新yum缓存

[root@localhost yum.repos.d]# yum makecache

2、安装mariadb

[root@localhost yum.repos.d]# yum install MariaDB-server MariaDB-client -y
## 安装过程中可能会报错出现报错
## 使用下面这条命令进行安装
[root@localhost yum.repos.d]# yum install epel-release -y

[root@localhost yum.repos.d]# yum install pv -y

[root@localhost yum.repos.d]# yum install mariadb mariadb-server -y

3、启动mariadb服务

[root@localhost yum.repos.d]# systemctl start mariadb.service

## 设置开机自启

[root@localhost yum.repos.d]# systemctl enable mariadb.service

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to

/usr/lib/systemd/system/mariadb.service.

## 验证mariadbd数据库3306端口是否开启

[root@localhost yum.repos.d]# netstat -antlupe | grep mariadbd

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 997

25388 2463/mariadbd

tcp6 0 0 :::3306 :::* LISTEN 997

25389 2463/mariadbd

4、安全初始化

[root@localhost yum.repos.d]# mariadb-secure-installation

Enter current password for root (enter for none):    ## 回车即可

Switch to unix_socket authentication [Y/n] n ##选择n

Change the root password? [Y/n] y ##设置mariadb服务root新密码

New password:000000

Re-enter new password:000000

Remove anonymous users? [Y/n] y ## 选择y

... Success!

Disallow root login remotely? [Y/n] n ##选择n 后面会进行配置

... skipping

Remove test database and access to it? [Y/n] y ##选择y

Reload privilege tables now? [Y/n] y ##选择y
5、测试登录mariadb

[root@localhost yum.repos.d]# mysql -uroot -p000000

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

6、Mariadb用户授权

root账号@添加远程登录权限及操作所有数据库的权限

MariaDB [(none)]> create user 'root'@'%' identified by '000000';

MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' ;

MariaDB [(none)]> exit

Bye

[root@localhost yum.repos.d]# cd

[root@localhost ~]#

部署PHP

1,依次执行以下命令

[root@localhost ~]# yum install epel-release -y
[root@localhost ~]# yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

[root@localhost ~]# yum -y install yum-utils
[root@localhost ~]# yum repolist all |grep php
[root@localhost ~]# yum-config-manager --enable remi-php74
[root@localhost ~]# yum install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis

2,修改 Apache 配置文件

[root@localhost ~]# vi /etc/httpd/conf/httpd.conf
3,进入配置文件按esc切换到末行模式输入set number可以显示行数

在96行插入  ServerName localhost:80

将104行的 Require all denied 修改为 Require all granted

将164行的 Directorylndex index.html改为DirectoryIndex index.php index.html

在285和286行中分别插入AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

按esc,输入wq 保存退出

执行以下命令,重启 Apache 服务

[root@localhost ~]# systemctl restart httpd

验证环境

[root@localhost ~]# echo "" >> /var/www/html/index.php 在浏览器中访问地址

http://192.168.220.233/index.php

出现以下即可


部署owncloud

安装上传软件包

[root@localhost ~]# yum install lrzsz unzip -y

用rz上传owncloud软件包

[root@yuchunle ~]# rz

[root@yuchunle ~]# ls

owncloud-complete-20231121.zip

解压压缩包并 复制到web端应用程序的存放目录

[root@yuchunle ~]# ls

owncloud-complete-20231121.zip

[root@yuchunle ~]# unzip owncloud-complete-20231121.zip

[root@yuchunle ~]# ls

owncloud owncloud-complete-20231121.zip

## 将目录 复制进web端存放目录

[root@yuchunle ~]# cp -r owncloud/ /var/www/html/

[root@yuchunle ~]# ls /var/www/html/

index.php owncloud

给目录进行权限赋值

[root@yuchunle ~]# chmod -R 755 /var/www/html/owncloud

[root@yuchunle ~]# ll /var/www/html/

总用量 8

-rw-r--r--. 1 root root 21 12月 5 23:03 index.php

. 12 root root 4096 12月 5 23:58 owncloud

创建owncloud数据库和授权

[root@yuchunle ~]# mysql -uroot -p000000  \## 进入数据库

MariaDB [(none)]> show databases; ## 查询所有数据库

## 创建owncloud数据库

MariaDB [(none)]> create database owncloud;

Query OK, 1 row affected (0.00 sec)

## 查询是否创建成功

MariaDB [(none)]> show databases;

创建wordpress数据库账户&&设置密码

MariaDB [(none)]> create user 'yu'@'%' identified by '000000';

MariaDB [(none)]> grant all privileges on *.* to 'yu'@'%';

MariaDB [(none)]> grant all privileges on wordpress.* to 'user'@'localhost';

MariaDB [(none)]> flush privileges;
## 退出数据库
MariaDB [(none)]> exit
Bye

配置selinux规则

[root@localhost ~]# setsebool -P httpd_unified 1

[root@localhost ~]# setsebool -P httpd_execmem 1

[root@localhost ~]# systemctl restart httpd

访问owncloud页面

\# 重启apache服务

systemctl restart httpd

\# 访问如下页面

http://192.168.220.233/owncloud/index.php

在浏览器访问出现以下页面即可


标签:mariadb,##,centos7,LAMP,owncloud,yum,php,root,localhost
From: https://blog.51cto.com/u_16534158/9400563

相关文章

  • CentOS7&Windows10的hosts文件设置
    CentOS7的hosts文件设置打开hosts文件vim/etc/hosts添加如下内容[IP][映射名称]如:127.0.0.1www.haha.com重启设备,查看主机名修改成功rebootWindows10的hosts文件的设置找到windows的hosts文件C:\Windows\System32\drivers\etc打开hosts文件添加cen......
  • CentOS7修改主机名
    查看主机名hostname临时修改主机名,当前登录有效,重启后无效hostname[主机名]//hostnamemaster修改配置文件,永久生效>vim/etc/hostname注意:改完配置文件,重启系统才能生效;如果不想重启实时生效往下看重启系统reboot或shutdown-rnow查看当......
  • centos7部署kafka服务
    centos7下面安装kafka服务,用于自己测试1.安装JAVA环境yum-yinstalljava-1.8.0-openjdk2.下载代码curl-okafka_2.13-3.6.1.tgzhttps://downloads.apache.org/kafka/3.6.1/kafka_2.13-3.6.1.tgz3.更改配置运行tar-xfkafka_2.13-3.6.1.tgzcdkafka_2.13-3.6.1se......
  • centos7.6使用docker搭建dnf私服
    服务端:1:配置SWAP虚拟内存1.1查看虚拟内存swapon--show1.2创建SWAP#创建一个文件并设置为swapfallocate-l8G/swapfilechmod600/swapfilemkswap/swapfileswapon/swapfilenano/etc/fstab#在最后一行粘贴以下内容,然后按Crtl+X,再按Y,然后回车/swap......
  • 解决centos7修改网卡名为eth0仍显示ens33的问题
    1.进入/etc/sysconfig/network-scripts修改网卡配置文件中的DEVICE=与NAME=参数为eth0保存退出后再修改网卡配置文件名mvifcfg-ens33ifcfg-eth02.重新生成grub2文件编辑/etc/default/grub配置文件,在GRUB_CMDLINE_LINUX这个参数后面加入:net.ifnames=0biosdevnam......
  • centos7环境部署psqlodbc
    1获取unixODBC和psqlodbc源码包打开https://github.com/lurcher/unixODBC/tags,以下载unixODBC-2.3.7.tar.gz为例打开https://www.postgresql.org/ftp/odbc/versions/src/,以下载psqlodbc-09.06.0500.tar.gz为例将下载好的软件包放在/home/postgres2编译安装unixODBC执行如......
  • Kettle部署centos7并添加远程图形界面访问
    Kettle部署centos7并添加远程图形界面访问安装运行环境安装远程访问(xmanager)添加中文支持安装运行环境kettle需要java环境才能运行,因此要安装Java,点击我查看部署jdk。安装图形化界面1yumgroupinstall"XWindowSystem" 上传ketle文件,并上传至服务器......
  • centos7 安装kettle 并实现图形化界面
    说实在的,在centos上实现kettle图形化,有点脱裤子放屁的感觉;话不多说干起来;本案例采用了kettle官网的pdi-ce-9.0.0.0-423.zip版本;centos7图形化工具为VNC-Server 一:部署kettle1.上传后,解压文件到指定目录unzippdi-ce-9.0.0.0-423.zip-d/data/software/2.进入:/data/softw......
  • Centos7 nat网络模式静态ip配置。
    配置流程:1.本机找到 VMwareNetworkAdapterVMnet8,然后配置ipv4: 2:vm里找到编辑->虚拟网络编辑器,然后按第一步里配置的信息来配置 VMwareNetworkAdapterVMnet8里的网关这些。   3:进入centos7系统,配置ifcfg-ens33,vi /etc/sysconfig/network-scripts/ifcfg......
  • centos7安装harbor配置私有镜像
    准备工作#关闭防火墙systemctlstopfirewalldsystemctldisablefirewalld#关闭SELinux和取消swapsed-i's/enforcing/disabled/'/etc/selinux/configsed-ri's/.*swap.*/#&/'/etc/fstab#主机名,根据你自己的情况来设置echo-e"192.168.50.10centos-k8s-mas......