[devops@localhost ~]$ su 암호: [root@localhost devops]# yum -y install gcc dkms make qt libgomp patch Loaded plugins: fastestmirror, langpacks base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 5.3 kB 00:00:00 extras | 3.4 kB 00:00:00 maradb | 2.9 kB 00:00:00 updates | 3.4 kB 00:00:00 webtatic | 3.6 kB 00:00:00 (1/2): epel/x86_64/primary_db | 6.1 MB 00:00:05 (2/2): epel/x86_64/updateinfo | 782 kB 00:00:11 Loading mirror speeds from cached hostfile * base: centos.mirror.moack.net * extras: data.aonenetworks.kr * updates: mirror.kakao.com * webtatic: us-east.repo.webtatic.com Resolving Dependencies --> Running transaction check ---> Package dkms.noarch 0:2.4.0-1.20170926git959bd74.el6 will be installed --> Processing Dependency: elfutils-libelf-devel for package: dkms-2.4.0-1.20170926git959bd74.el6.noarch --> Processing Dependency: kernel-devel-uname-r for package: dkms-2.4.0-1.20170926git959bd74.el6.noarch ---> Package gcc.x86_64 0:4.8.5-11.el7 will be updated --> Processing Dependency: gcc = 4.8.5-11.el7 for package: gcc-c++-4.8.5-11.el7.x86_64 ---> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be an update --> Processing Dependency: cpp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64 --> Processing Dependency: libgcc >= 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64 ---> Package libgomp.x86_64 0:4.8.5-11.el7 will be updated ---> Package libgomp.x86_64 0:4.8.5-36.el7_6.2 will be an update ---> Package make.x86_64 1:3.82-21.el7 will be updated ---> Package make.x86_64 1:3.82-23.el7 will be an update ---> Package patch.x86_64 0:2.7.1-10.el7_5 will be installed ---> Package qt.x86_64 1:4.8.7-2.el7 will be installed --> Processing Dependency: qt-settings for package: 1:qt-4.8.7-2.el7.x86_64 --> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: 1:qt-4.8.7-2.el7.x86_64 --> Running transaction check ---> Package cpp.x86_64 0:4.8.5-11.el7 will be updated ---> Package cpp.x86_64 0:4.8.5-36.el7_6.2 will be an update ---> Package elfutils-libelf-devel.x86_64 0:0.172-2.el7 will be installed --> Processing Dependency: elfutils-libelf(x86-64) = 0.172-2.el7 for package: elfutils-libelf-devel-0.172-2.el7.x86_64 ---> Package gcc-c++.x86_64 0:4.8.5-11.el7 will be updated ---> Package gcc-c++.x86_64 0:4.8.5-36.el7_6.2 will be an update --> Processing Dependency: libstdc++-devel = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64 --> Processing Dependency: libstdc++ = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64 ---> Package kernel-debug-devel.x86_64 0:3.10.0-957.21.3.el7 will be installed ---> Package libgcc.x86_64 0:4.8.5-11.el7 will be updated ---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be an update ---> Package openssl-libs.x86_64 1:1.0.1e-60.el7_3.1 will be updated --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1 for package: 1:openssl-1.0.1e-60.el7_3.1.x86_64 --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1 for package: 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64 ---> Package openssl-libs.x86_64 1:1.0.2k-16.el7_6.1 will be an update ---> Package qt-settings.noarch 0:19-23.8.el7.centos will be installed --> Running transaction check ---> Package elfutils-libelf.x86_64 0:0.160-1.el7 will be updated --> Processing Dependency: elfutils-libelf(x86-64) = 0.160-1.el7 for package: elfutils-libs-0.160-1.el7.x86_64 --> Processing Dependency: elfutils-libelf(x86-64) = 0.160-1.el7 for package: elfutils-0.160-1.el7.x86_64 ---> Package elfutils-libelf.x86_64 0:0.172-2.el7 will be an update ---> Package libstdc++.x86_64 0:4.8.5-11.el7 will be updated ---> Package libstdc++.x86_64 0:4.8.5-36.el7_6.2 will be an update ---> Package libstdc++-devel.x86_64 0:4.8.5-11.el7 will be updated ---> Package libstdc++-devel.x86_64 0:4.8.5-36.el7_6.2 will be an update ---> Package openssl.x86_64 1:1.0.1e-60.el7_3.1 will be updated ---> Package openssl.x86_64 1:1.0.2k-16.el7_6.1 will be an update ---> Package openssl-devel.x86_64 1:1.0.1e-60.el7_3.1 will be updated ---> Package openssl-devel.x86_64 1:1.0.2k-16.el7_6.1 will be an update --> Running transaction check ---> Package elfutils.x86_64 0:0.160-1.el7 will be updated ---> Package elfutils.x86_64 0:0.172-2.el7 will be an update ---> Package elfutils-libs.x86_64 0:0.160-1.el7 will be updated ---> Package elfutils-libs.x86_64 0:0.172-2.el7 will be an update --> Processing Dependency: default-yama-scope for package: elfutils-libs-0.172-2.el7.x86_64 --> Running transaction check ---> Package elfutils-default-yama-scope.noarch 0:0.172-2.el7 will be installed --> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================================================================================================== Installing: dkms noarch 2.4.0-1.20170926git959bd74.el6 epel 78 k patch x86_64 2.7.1-10.el7_5 base 110 k qt x86_64 1:4.8.7-2.el7 base 4.6 M Updating: gcc x86_64 4.8.5-36.el7_6.2 updates 16 M libgomp x86_64 4.8.5-36.el7_6.2 updates 158 k make x86_64 1:3.82-23.el7 base 420 k Installing for dependencies: elfutils-default-yama-scope noarch 0.172-2.el7 base 32 k elfutils-libelf-devel x86_64 0.172-2.el7 base 39 k kernel-debug-devel x86_64 3.10.0-957.21.3.el7 updates 17 M qt-settings noarch 19-23.8.el7.centos base 17 k Updating for dependencies: cpp x86_64 4.8.5-36.el7_6.2 updates 5.9 M elfutils x86_64 0.172-2.el7 base 299 k elfutils-libelf x86_64 0.172-2.el7 base 194 k elfutils-libs x86_64 0.172-2.el7 base 285 k gcc-c++ x86_64 4.8.5-36.el7_6.2 updates 7.2 M libgcc x86_64 4.8.5-36.el7_6.2 updates 102 k libstdc++ x86_64 4.8.5-36.el7_6.2 updates 305 k libstdc++-devel x86_64 4.8.5-36.el7_6.2 updates 1.5 M openssl x86_64 1:1.0.2k-16.el7_6.1 updates 493 k openssl-devel x86_64 1:1.0.2k-16.el7_6.1 updates 1.5 M openssl-libs x86_64 1:1.0.2k-16.el7_6.1 updates 1.2 M
[root@localhost devops]# yum -y install kernel-headers kernel-devel binutils glibc-headers glibc-devel font-forge Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.moack.net * extras: data.aonenetworks.kr * updates: mirror.kakao.com * webtatic: us-east.repo.webtatic.com No package font-forge available. Resolving Dependencies --> Running transaction check ---> Package binutils.x86_64 0:2.23.52.0.1-30.el7 will be updated ---> Package binutils.x86_64 0:2.27-34.base.el7 will be an update ---> Package glibc-devel.x86_64 0:2.17-157.el7_3.1 will be updated ---> Package glibc-devel.x86_64 0:2.17-260.el7_6.5 will be an update --> Processing Dependency: glibc = 2.17-260.el7_6.5 for package: glibc-devel-2.17-260.el7_6.5.x86_64 ---> Package glibc-headers.x86_64 0:2.17-157.el7_3.1 will be updated ---> Package glibc-headers.x86_64 0:2.17-260.el7_6.5 will be an update ---> Package kernel-devel.x86_64 0:3.10.0-957.21.3.el7 will be installed ---> Package kernel-headers.x86_64 0:3.10.0-514.10.2.el7 will be updated ---> Package kernel-headers.x86_64 0:3.10.0-957.21.3.el7 will be an update --> Running transaction check ---> Package glibc.x86_64 0:2.17-157.el7_3.1 will be updated --> Processing Dependency: glibc = 2.17-157.el7_3.1 for package: glibc-common-2.17-157.el7_3.1.x86_64 ---> Package glibc.x86_64 0:2.17-260.el7_6.5 will be an update --> Running transaction check ---> Package glibc-common.x86_64 0:2.17-157.el7_3.1 will be updated ---> Package glibc-common.x86_64 0:2.17-260.el7_6.5 will be an update --> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================================================================================================== Installing: kernel-devel x86_64 3.10.0-957.21.3.el7 updates 17 M Updating: binutils x86_64 2.27-34.base.el7 base 5.9 M glibc-devel x86_64 2.17-260.el7_6.5 updates 1.1 M glibc-headers x86_64 2.17-260.el7_6.5 updates 683 k kernel-headers x86_64 3.10.0-957.21.3.el7 updates 8.0 M Updating for dependencies: glibc x86_64 2.17-260.el7_6.5 updates 3.7 M glibc-common x86_64 2.17-260.el7_6.5 updates 12 M
[root@localhost devops]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ls CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-fasttrack.repo docker-ce.repo epel-testing.repo epel.repo mariadb.repo webtatic-archive.repo webtatic-testing.repo webtatic.repo [root@localhost yum.repos.d]# ll 합계 52 -rw-r--r--. 1 root root 1664 4월 1 2015 CentOS-Base.repo -rw-r--r--. 1 root root 1309 4월 1 2015 CentOS-CR.repo -rw-r--r--. 1 root root 649 4월 1 2015 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 1331 4월 1 2015 CentOS-Sources.repo -rw-r--r--. 1 root root 1002 4월 1 2015 CentOS-Vault.repo -rw-r--r--. 1 root root 290 4월 1 2015 CentOS-fasttrack.repo -rw-r--r--. 1 root root 2424 10월 25 2018 docker-ce.repo -rw-r--r--. 1 root root 1056 11월 5 2012 epel-testing.repo -rw-r--r--. 1 root root 960 6월 20 12:28 epel.repo -rw-r--r--. 1 root root 139 2월 24 2017 mariadb.repo -rw-r--r--. 1 root root 963 11월 13 2016 webtatic-archive.repo -rw-r--r--. 1 root root 963 11월 13 2016 webtatic-testing.repo -rw-r--r--. 1 root root 865 11월 13 2016 webtatic.repo [root@localhost yum.repos.d]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo --2019-06-21 11:04:18-- http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo Resolving download.virtualbox.org (download.virtualbox.org)... 23.35.220.157 Connecting to download.virtualbox.org (download.virtualbox.org)|23.35.220.157|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 259 [text/plain] Saving to: ‘virtualbox.repo’
100%[=====================================================================================================================================================================================================================================>] 259 --.-K/s in 0s
Total download size: 116 M Installed size: 238 M Downloading packages: 경고: /var/cache/yum/x86_64/7/virtualbox/packages/VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY========================================================================================-] 8.1 MB/s | 116 MB 00:00:00 ETA Public key for VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm is not installed VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm | 116 MB 00:00:14 Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc Importing GPG key 0x98AB5139: Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>" Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139 From : https://www.virtualbox.org/download/oracle_vbox.asc Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : VirtualBox-6.0-6.0.8_130520_el7-1.x86_64 1/1
Creating group 'vboxusers'. VM users must be member of that group!
This system is currently not set up to build kernel modules. Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system. The distribution packages containing the headers are probably: kernel-devel kernel-devel-3.10.0-229.el7.x86_64 This system is currently not set up to build kernel modules. Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system. The distribution packages containing the headers are probably: kernel-devel kernel-devel-3.10.0-229.el7.x86_64
There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root. If your system is using EFI Secure Boot you may need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information. Verifying : VirtualBox-6.0-6.0.8_130520_el7-1.x86_64 1/1 Installed: VirtualBox-6.0.x86_64 0:6.0.8_130520_el7-1 Complete!
[root@localhost yum.repos.d]# rcvboxdrv setup vboxdrv.sh: Stopping VirtualBox services. vboxdrv.sh: Starting VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. This system is currently not set up to build kernel modules. Please install the Linux kernel "header" files matching the current kernel for adding new hardware support to the system. The distribution packages containing the headers are probably: kernel-devel kernel-devel-3.10.0-957.el7.x86_64
상위와 같이 virtual box를 셋업 했을 경우
Please install the Linux kernel "header" files matching the current kernel
================================================================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================================================================== Installing: kernel-devel x86_64 3.10.0-957.el7 base 17 M
Total download size: 17 M Installed size: 37 M Is this ok [y/d/N]: y Downloading packages: No Presto metadata available for base kernel-devel-3.10.0-957.el7.x86_64.rpm | 17 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : kernel-devel-3.10.0-957.el7.x86_64 1/1 Verifying : kernel-devel-3.10.0-957.el7.x86_64 1/1
Total size: 190 M Installed size: 190 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:vagrant-1.9.6-1.x86_64 1/1 Verifying : 1:vagrant-1.9.6-1.x86_64 1/1
Installed: vagrant.x86_64 1:1.9.6-1
Complete!
Vagrant Start
vagrant init
vagrant up
으로 최초 vagrant가 잘 install 되었는지 확인 가능하지만
Provider를 설정해달라는 요청이 나오게 되는데
vagrant up --provider=virtualbox
와 같이 provider를 설정 해주면 된다.
[root@localhost yum.repos.d]# cd ~ [root@localhost ~]# ls anaconda-ks.cfg [root@localhost ~]# mkdir vagrant [root@localhost ~]# cd vagrant/ [root@localhost vagrant]# ls [root@localhost vagrant]# vagrant init A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. [root@localhost vagrant]# vagrant up No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as "providers", to provide Vagrant with resources to run development environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which is available for free on all major platforms.
If you believe you already have a provider available, make sure it is properly installed and configured. You can see more details about why a particular provider isn't working by forcing usage with `vagrant up --provider=PROVIDER`, which should give you a more specific error message for that particular provider.
centos/7이라는 box를 vagrant에 등록 해준다.
이때 default Provider를 선택하면 앞서 --provider= 옵션을 사용하지 않아도 된다.
[root@localhost vagrant]# vagrant box add centos/7 ==> box: Loading metadata for box 'centos/7' box: URL: https://vagrantcloud.com/centos/7 This box can work with multiple providers! The providers that it can work with are listed below. Please review the list and choose the provider you will be working with.
Enter your choice: 3 ==> box: Adding box 'centos/7' (v1902.01) for provider: virtualbox box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1902.01/providers/virtualbox.box ==> box: Successfully added box 'centos/7' (v1902.01) for'virtualbox'!
vagrant init
명령어를 사용할 경우
해당 명령어를 실행한 디렉토리에
Vagrantfile이 생성되는데, VM에 대한 설정을 할 수있다.
여기에서는
config.vm.box = "centos/7" 이 부분만 수정 함으로써 기본 OS가 centos 7 버전이라는 것을 알려주었다.
# -*- mode: ruby -*- # vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "centos/7"
[root@localhost vagrant]# vagrant up --provider=virtualbox The provider 'virtualbox' that was requested to back the machine 'default' is reporting that it isn't usable on this system. The reason is shown below: Vagrant has detected that you have a version of VirtualBox installed that is not supported by this version of Vagrant. Please install one of the supported versions listed below to use Vagrant: 4.0, 4.1, 4.2, 4.3, 5.0, 5.1 A Vagrant update may also be available that adds support for the version you specified. Please check www.vagrantup.com/downloads.html to download the latest version. [root@localhost vagrant]# yum update vagrant Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.mirror.moack.net * extras: centos.mirror.moack.net * updates: centos.mirror.moack.net No packages marked for update [root@localhost vagrant]# yum uninstall vagrant Loaded plugins: fastestmirror, langpacks No such command: uninstall. Please use /usr/bin/yum --help [root@localhost vagrant]# rm -rf /opt/vagrant/ [root@localhost vagrant]# rm -f /usr/bin/vagrant [root@localhost vagrant]# sudo wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm --2019-06-21 19:40:06-- https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.229.183, 2a04:4e42:36::439 Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.229.183|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 40824607 (39M) [application/x-redhat-package-manager] Saving to: ‘vagrant_2.2.4_x86_64.rpm’ 100%[========================================================================================================================================================================>] 40,824,607 9.96MB/s in 4.7s 2019-06-21 19:40:12 (8.20 MB/s) - ‘vagrant_2.2.4_x86_64.rpm’ saved [40824607/40824607] [root@localhost vagrant]# vagrant --version bash: /usr/bin/vagrant: 그런 파일이나 디렉터리가 없습니다 [root@localhost vagrant]# vagrnat bash: vagrnat: 명령을 찾을 수 없습니다... [root@localhost vagrant]# ls Vagrantfile vagrant_2.2.4_x86_64.rpm [root@localhost vagrant]# sudo yum localinstall vagrant_2.2.4_x86_64.rpm Loaded plugins: fastestmirror, langpacks Examining vagrant_2.2.4_x86_64.rpm: 1:vagrant-2.2.4-1.x86_64 Marking vagrant_2.2.4_x86_64.rpm as an update to 1:vagrant-1.9.6-1.x86_64 Resolving Dependencies --> Running transaction check ---> Package vagrant.x86_64 1:1.9.6-1 will be updated ---> Package vagrant.x86_64 1:2.2.4-1 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================================================================== Updating: vagrant x86_64 1:2.2.4-1 /vagrant_2.2.4_x86_64 110 M Transaction Summary ================================================================================================================================================================================================================== Upgrade 1 Package Total size: 110 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : 1:vagrant-2.2.4-1.x86_64 1/2 Cleanup : 1:vagrant-1.9.6-1.x86_64 2/2 경고: file /opt/vagrant/embedded/share/info/rluserman.info: remove failed: 그런 파일이나 디렉터리가 없습니다 경고: file /opt/vagrant/embedded/share/info/readline.info: remove failed: 그런 파일이나 디렉터리가 없습니다 경고: file /opt/vagrant/embedded/share/info/libffi.info: remove failed: 그런 파일이나 디렉터리가 없습니다
앞서 vagrant를 새롭게 install 하였고, 아래와 같이 centos/7을 init 해보자.
vagrant init centos/7
vagrant up
[root@localhost vagrant-centos-7]# vagrant init centos/7 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. [root@localhost vagrant-centos-7]# vagrant up
Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'centos/7'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'centos/7' version '1902.01' is up to date... ==> default: Setting the name of the VM: vagrant-centos-7_default_1561113935045_2937 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: No guest additions were detected on the base box for this VM! Guest default: additions are required for forwarded ports, shared folders, host only default: networking, and more. If SSH fails on this machine, please install default: the guest additions and repackage the box to continue. default: default: This is not an error message; everything may continue to work properly, default: in which case you may ignore this message. ==> default: Rsyncing folder: /root/vagrant-centos-7/ => /vagrant
상위와 같이 로그가 나왔다면, 성공적으로 virtual box, vagrant가 install 된것이다.