어제와 똑같이 살면서 다른 미래를 기대하지 말자

Vagrant centos/7 본문

IT관심분야/Linux

Vagrant centos/7

플랜액터 2019. 11. 24. 01:41

1. Vagrant 설치

https://www.vagrantup.com/downloads.html

 

2. VirtualBox 설치

https://www.virtualbox.org/wiki/Downloads

 

3. Vagrant CentOS 7 설치

$ vagrant init centos/7

$ vagrant up

$ vagrant plugin install vagrant-vbguest

Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-3.0.0.gem (100%)
Fetching: vagrant-vbguest-0.21.0.gem (100%)
Installed the plugin 'vagrant-vbguest (0.21.0)'!

$ vagrant reload

 

4. 개발환경 세팅

1) 기본설정

$ vagrant ssh

 

# yum install dnf

# yum install dnf-yum

# dnf install net-tools

# dnf install epel-release

# dnf install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

 

2) PHP 설치

# dnf --enablerepo=remi-php73 install php php-mysql php-gd php-mcrypt php-mbstring php-opcache php-pear php-xml php-xmlrpc php-embedded php-bcmath php-imap php-pdo php-pecl-imagick php-soap php-devel php-ldap php-intl php-pecl-apcu php-snmp php-tidy php-dba php-zip

 

3) Apache 설치(httpd)

# dnf install httpd

 

4) Mariadb 설치

# dnf install mariadb mariadb-server mariadb-devel

 

# vi /etc/my.cnf.d/client.cnf

[client]

default-character-set=utf8

 

# vi /etc/my.cnf.d/server.cnf

[mysqld]

collation-server = utf8_unicode_ci

init-connect='SET NAMES utf8'

character-set-server = utf8

 

# systemctl start mariadb

# mysql -u root mysql

[mysql]> show variables like 'c%';

+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
| collation_connection     | utf8_general_ci            |
| collation_database       | utf8_unicode_ci            |
| collation_server         | utf8_unicode_ci            |
| completion_type          | NO_CHAIN                   |
| concurrent_insert        | AUTO                       |
| connect_timeout          | 10                         |
+--------------------------+----------------------------+

 

# systemctl enable mariadb

 

5. 프로젝트 세팅

 

# vi Vatrantfile

 

Vagrant.configure("2") do |config|
  config.vm.define "default", primary: true, autostart: true do |cfg|
    cfg.vm.box = "centos/7"
    # cfg.vm.box_check_update = false
    # cfg.vm.network "forwarded_port", guest: 80, host: 8080
    cfg.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1"
    cfg.vm.network "private_network", ip: "192.168.100.100"
    # cfg.vm.network "public_network"
    cfg.vm.synced_folder "./test", "/home/test", owner: "vagrant", group: "vagrant", disabled: false
    cfg.vm.provider "virtualbox" do |v|
        v.memory = 1024
v.cpus = 2
    end
    cfg.vm.provision "shell", inline: <<-SHELL
    SHELL
  end
end

 

 

 

 

Comments