1. 환경
OS : Ubuntu 18.04 LTS (VM) Server
2. Composer 설치
"apt"로 "Composer"를 설치하기 위해서 아래와 같이 "/etc/apt/sources.list" 파일에 파란색 부분을 추가한다.
bobocomi@localhost:~$ sudo vi /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe
"apt update"를 실행하여 레포지터리 정보를 업데이트한다.
bobocomi@localhost:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4,941 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-security/main Translation-en [81.5 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [97.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [54.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [166 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [578 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [156 kB]
Fetched 15.3 MB in 8s (1,824 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
120 packages can be upgraded. Run 'apt list --upgradable' to see them.
"apt -y install composer"를 실행하여, "Laravel" 설치 도우미인 "Composer"를 설치한다.
bobocomi@localhost:~$ sudo apt -y install composer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
jsonlint libsodium23 php-cli php-cli-prompt php-common php-composer-ca-bundle php-composer-semver php-composer-spdx-licenses php-json-schema php-psr-log php-symfony-console php-symfony-debug
php-symfony-filesystem php-symfony-finder php-symfony-polyfill-mbstring php-symfony-process php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline
Suggested packages:
fossil mercurial subversion php-zip php-symfony-event-dispatcher php-symfony-lock php-mbstring php-pear
The following NEW packages will be installed:
composer jsonlint libsodium23 php-cli php-cli-prompt php-common php-composer-ca-bundle php-composer-semver php-composer-spdx-licenses php-json-schema php-psr-log php-symfony-console
php-symfony-debug php-symfony-filesystem php-symfony-finder php-symfony-polyfill-mbstring php-symfony-process php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline
0 upgraded, 22 newly installed, 0 to remove and 120 not upgraded.
Need to get 3,222 kB of archives.
After this operation, 16.1 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 php-common all 1:60ubuntu1 [12.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 php7.2-common amd64 7.2.10-0ubuntu0.18.04.1 [878 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 php7.2-json amd64 7.2.10-0ubuntu0.18.04.1 [18.8 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 php7.2-opcache amd64 7.2.10-0ubuntu0.18.04.1 [165 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 php7.2-readline amd64 7.2.10-0ubuntu0.18.04.1 [12.1 kB]
...
"Composer" 설치를 확인한다.
bobocomi@localhost:~$ composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer 1.6.3 2018-01-31 16:28:17
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
about Shows the short information about Composer.
archive Creates an archive of this composer package.
browse [home] Opens the package's repository URL or homepage in your browser.
check-platform-reqs Check that platform requirements are satisfied.
clear-cache [clearcache] Clears composer's internal package cache.
config Sets config options.
create-project Creates new project from a package into given directory.
depends [why] Shows which packages cause the given package to be installed.
diagnose Diagnoses the system to identify common errors.
dump-autoload [dumpautoload] Dumps the autoloader.
exec Executes a vendored binary/script.
global Allows running commands in the global composer dir ($COMPOSER_HOME).
help Displays help for a command
init Creates a basic composer.json file in current directory.
install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
licenses Shows information about licenses of dependencies.
list Lists commands
outdated Shows a list of installed packages that have updates available, including their latest version.
prohibits [why-not] Shows which packages prevent the given package from being installed.
remove Removes a package from the require or require-dev.
require Adds required packages to your composer.json and installs them.
run-script Runs the scripts defined in composer.json.
search Searches for packages.
show [info] Shows information about packages.
status Shows a list of locally modified packages.
suggests Shows package suggestions.
update [upgrade] Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
validate Validates a composer.json and composer.lock.
3. Laravel 설치
"Composer"로 "Laravel"을 설치하기 전에, "php-zip"을 설치한다.
bobocomi@localhost:~$ sudo apt -y install php-zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libzip4 php7.2-zip
The following NEW packages will be installed:
libzip4 php-zip php7.2-zip
0 upgraded, 3 newly installed, 0 to remove and 120 not upgraded.
Need to get 60.1 kB of archives.
After this operation, 204 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libzip4 amd64 1.1.2-1.1 [37.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 php7.2-zip amd64 7.2.10-0ubuntu0.18.04.1 [20.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 php-zip all 1:7.2+60ubuntu1 [1,996 B]
Fetched 60.1 kB in 2s (39.0 kB/s)
Selecting previously unselected package libzip4:amd64.
(Reading database ... 102987 files and directories currently installed.)
Preparing to unpack .../libzip4_1.1.2-1.1_amd64.deb ...
Unpacking libzip4:amd64 (1.1.2-1.1) ...
Selecting previously unselected package php7.2-zip.
Preparing to unpack .../php7.2-zip_7.2.10-0ubuntu0.18.04.1_amd64.deb ...
Unpacking php7.2-zip (7.2.10-0ubuntu0.18.04.1) ...
Selecting previously unselected package php-zip.
Preparing to unpack .../php-zip_1%3a7.2+60ubuntu1_all.deb ...
Unpacking php-zip (1:7.2+60ubuntu1) ...
Setting up libzip4:amd64 (1.1.2-1.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up php7.2-zip (7.2.10-0ubuntu0.18.04.1) ...
Creating config file /etc/php/7.2/mods-available/zip.ini with new version
Setting up php-zip (1:7.2+60ubuntu1) ...
"Composer"로 "Laravel"을 설치한다.
bobocomi@localhost:~$ composer global require laravel/installer
Changed current directory to /home/bobocomi/.config/composer
Using version ^2.0 for laravel/installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 10 installs, 0 updates, 0 removals
- Installing symfony/process (v4.1.8): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.10.0): Downloading (100%)
- Installing symfony/filesystem (v4.1.8): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.10.0): Downloading (100%)
- Installing symfony/console (v4.1.8): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
- Installing laravel/installer (v2.0.1): Downloading (100%)
symfony/polyfill-mbstring suggests installing ext-mbstring (For best performance)
symfony/console suggests installing psr/log-implementation (For using the console logger)
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/lock ()
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file
Generating autoload files
폴더 위치에 상관 없이 "laravel" 명령어를 실행할 수 있도록, 환경변수($PATH)에 "bin" 폴더 정보를 추가한다.
bobocomi@localhost:~$ ll
total 40
drwxr-xr-x 3 root root 4096 Nov 27 07:02 ../
-rw-r--r-- 1 bobocomi bobocomi 220 Apr 4 2018 .bash_logout
-rw-r--r-- 1 bobocomi bobocomi 3771 Apr 4 2018 .bashrc
drwx------ 3 bobocomi bobocomi 4096 Nov 27 07:07 .cache/
drwxrwxr-x 3 bobocomi bobocomi 4096 Nov 27 07:07 .config/
drwx------ 3 bobocomi bobocomi 4096 Nov 27 07:04 .gnupg/
drwxrwxr-x 3 bobocomi bobocomi 4096 Nov 27 07:07 .local/
-rw-r--r-- 1 bobocomi bobocomi 972 Nov 27 07:29 .profile
-rw-r--r-- 1 bobocomi bobocomi 0 Nov 27 07:04 .sudo_as_admin_successful
-rw------- 1 root root 882 Nov 27 07:05 .viminfo
"laravel new blog" 명령어 폴더 및 파일 생성시에 에러가 발생할 수 있으므로 아래 와 같이 패키지를 추가 설치한다.
bobocomi@localhost:~$ sudo apt -y install php-mbstring php-xml
bobocomi@localhost:~$ laravel new blog
※ php-dom 패키지가 php-xml로 대체된 듯..
이후 과정은, "https://laravel.kr/docs/5.7/installation" 설치내용을 참조한다.