2022년 4월 7일 목요일

[ Laravel ] Centos에서 Laravel 설치

 

Centos에서 Laravel 설치


[ APM설치 ]

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install epel-release yum-utils
yum-config-manager --enable remi-php74
yum install httpd
yum install php php-cli php-bcmath php-bz2 php-common php-curl php-dba php-gd php-json php-mbstring php-opcache php-readline php-soap php-xml php-xmlrpc php-zip php-ctype php-pdo php-redis php-mysql php-imagick php-intl

vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

yum install MariaDB-server MariaDB-client
systemctl enable httpd
systemctl enable mariadb


[ Apache /etc/httpd/conf/http.conf 설정 ] (빨간색 추가 및 변경)

LoadModule rewrite_module modules/mod_rewrite.so

<Directory "/home/centos">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

# Virtual hosts
Include conf/extra/httpd-vhosts.conf


[ /etc/httpd/conf/extra/httpd-vhosts.conf 설정 ]

<VirtualHost *:80>
    ServerAdmin mygmail@gmail.com
    DocumentRoot "/home/centos/laravel_project/public"
    ServerName 11.22.333.44
    #ServerAlias 11.22.333.44
    ErrorLog "/home/centos/laravel_project/logs/error_log"
    CustomLog "/home/centos/laravel_project/logs/access_log" common
        <Directory /home/centos/laravel_project/public/>
                AllowOverride All
                Allow from all
        </Directory>
        <Directory /home/centos/laravel_project/storage/>
                AllowOverride All
                Allow from all
        </Directory>
</VirtualHost>


[ 라라벨 설치 ]

timedatectl set-timezone Asia/Seoul
# 라라벨을 인스톨을 제공하는 composer설치
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin/
ln -s /usr/bin/composer.phar /usr/bin/composer

# 라라벨 설치
composer global require laravel/installer
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
source .bashrc

# 새 프로젝트 생성
laravel new laravel_project


[ 폴더 권한 변경 ]

1. 라라벨 폴더 경로가 /home/centos/laravel_project 라면 3개폴더 모두 chmod 755
2. chmod -R 777 laravel_project/storage (정확히 framework, logs 폴더때문)


[ 실행 ]

systemctl restart httpd
web url창에 11.22.333.44로 접속


[ 실행 화면 ]






댓글 없음:

댓글 쓰기