加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

centos 7系统下安装laravel运行环境的步骤详解

发布时间:2020-12-14 20:03:09 所属栏目:大数据 来源:网络整理
导读:前言 因为最近在学习linux,而最好的学习就是实践,学习linux同时安装LAMP的环境搭配,跑了度娘都没找到我想要的文章。那我就简单的写写我在centos7下安装laravel的安装过程。 网络设置 ping 114.114.114.144 网络连接失败,将虚拟机的网络适配器改成桥接模式

前言

因为最近在学习linux,而最好的学习就是实践,学习linux同时安装LAMP的环境搭配,跑了度娘都没找到我想要的文章。那我就简单的写写我在centos7下安装laravel的安装过程。

网络设置

ping 114.114.114.144 网络连接失败,将虚拟机的网络适配器改成桥接模式(自动),然后设置开启启动

打开 /etc/sysconfig/network-scripts/ifcfg-eno16777736,ifcfg-eno16777736是自己对应的配置文件

将里面的ONBOOT改为yes,重启网络服务`systemctl restart network`,再ping就ok了

升级

SELinux 宽容模式保证安装过程不受影响,其次在项目中,也要关闭

安装Apache

//同时安装vim
yum install vim

//修改Apache配置文件指向路径
/etc/httpd/conf/httpd.conf

//启动Apache
systemctl start httpd

//停止Apache
systemctl stop httpd

//重启Apache
systemctl restart httpd

//查看Apache状态
systemctl status httpd

// 配置Apache开机启动项
/chkconfig --add httpd (在服务清单中添加httpd服务)/
chkconfig httpd on

安装MySql

//最后使用像安装MySQL的常规方法一样安装
//安装mysql命令
yum -y installmysql mysql-devel mysql-server mysql-libs

//创建root用户密码
mysqladmin -u root password 密码

//如果要用外部软件连接数据库关闭防火墙
systemctl stop firewalld

//查看防火墙状态
firewall-cmd --state

//禁止firewall开机启动
systemctl disable firewalld

//设置远程连接
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

//重启mysql
systemctl restart mysqld
cd ..//

安装PHP5.6

yum -y install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

//使用yum list命令查看可安装的包(Packege)。
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php

//安装php5.6及部分扩展
yum -y install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

//查看版本
php-v

安装redis

yum install gcc-c++
yum install -y tcl

//获取安装文件
wget http://download.redis.io/releases/redis-3.2.9.tar.gz
tar xzf redis-3.2.9.tar.gz
mv redis-3.2.9 /usr/local/redis

//进入目录
cd /usr/local/redis

//编译安装
make && make install
(可能需要 make test 根据提示)

//设置配置文件目录
mkdir -p /etc/redis
cp redis.conf /etc/redis

//修改配置文件
vim /etc/redis/redis.conf
daemonize yes (no -> yes)

//启动
/usr/local/bin/redis-server /etc/redis/redis.conf

//查看启动
ps -ef | grep redis

//使用客户端测试
redis-cli
set name darry
Ok
get name
'darry'

//关闭客户端
redis-cli shutdown

没有设置开机自启动,要设置[点击这里][1]

安装composer

用户操作获得root权限

//修改密码
passwd darry //修改密码
Changing password for user darry
New UNIX password: //在这里输入新密码
Retype new UNIX password: //再次输入新密码
passwd: all authentication tokens updated successfully.

//修改用户权限
修改 /etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:

Allow root to run any commands anywhere

root ALL=(ALL) ALL
darry ALL=(ALL) ALL

修改完毕,现在可以用darry帐号登录,然后用命令 su - darry,即可获得root权限进行操作。

通过composer安装laravel

//在创建项目的时候注意,在root用户下避免不安全,composer会提示,然后用另外用户登录
composer create-project laravel/laravel blog 5.1.11 //安装5.1
composer create-project laravel/laravel=5.2.* blog --prefer-dist //安装的5.2

//修改laravel权限
cd blog
sudo chmod -R 777 storage
sudo chmod -R 777 vendor

//检查安装依赖程序
yum install gcc-c++
yum install -y tcl

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对编程之家的支持。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读