The site was using VirtualBox and Vagrant
Introducing CentOS 8 virtual environment with VirtualBox and Vagrant (Windows 10)
I didn't have any particular problems How to install VirtualBox Vagrant installation procedure (Windows 10, CentOS 7.2, Vagrant 1.9.5, VirtualBox 5.1.22)
Pycharm The console usually uses Pycharm. PowerShell is specified
The folder I usually use for the development environment is "dev", so "cd" to that point. There are already ".vagrant" and "Vagrantfile", but this is the result screen. From now on, these two files will be created.
I think CentOS download will take about 8 minutes
dev> vagrant box add generic/CentOS8
1) docker
2) hyperv
3) libvirt
4) parallels
5) virtualbox
6) vmware_desktop
Enter your choice: 5
dev> vagrant init generic/CentOS8
Does Windows have vi ... and does it have "vi" ... How to use the text editor "Vim" on Windows
Major changes
Uncomment config.vm.network" forwarded_port ", guest: 80, host: 8080, host_ip:" 127.0.0.1 "
Changed to config.vm.network" private_network ", ip:" 127.0.0.1 "
Uncomment config.vm.synced_folder" ../ data "," / vagrant_data "
Changed to config.vm.synced_folder"./ "," / var / www "
config.vm.provider "virtualbox" do |vb|
And a few lines downend
Uncomment
Uncomment vb.memory =" 1024 "`` vb.memory = "2048"
dev> vim Vagrantfile
# -*- 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 = "generic/CentOS8"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
config.vm.network "private_network", ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./", "/var/www"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "2048"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
Oh! I wanted to go. You can see the Python directory properly. I'm happy that I don't have to change the existing directory structure (there is no rule to put it in the vagrant directory)
Console
dev> vagrant up
dev> vagrant ssh
[vagrant@CentOS8 ~]$ cd /var/www
[vagrant@CentOS8 www]$ ls
Arduino Gas Php Portfolio Python Qgis Vagrantfile Vba
How to add Japanese locale to CentOS 7 Vagrant box of v1801.01 date hasn't changed for some reason
[root@CentOS8 vagrant]# localectl set-locale LANG=ja_JP.UTF-8
[root@centos8 vagrant]# localectl status
System Locale: LANG=ja_JP.UTF-8
VC Keymap: us
X11 Layout: n/a
[root@CentOS8 vagrant]# date
Sat Oct 10 05:22:38 UTC 2020 (* Currently Sat Oct 10 14:23:00)
python3 → python
Console
[root@centos8 vagrant]# python3 --version
Python 3.6.8
(* Select 2)
[root@centos8 vagrant]# alternatives --config python
There are 2 programs which provide 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/libexec/no-python
2 /usr/bin/python3
Enter to keep the current selection[+], or type selection number: 2
[root@centos8 vagrant]# python --version
Python 3.6.8
[root@centos8 vagrant]#
(* There is no pip)
[root@centos8 vagrant]# pip --version
bash: pip: command not found
[root@centos8 vagrant]# which pip
/usr/bin/which: no pip in (/sbin:/bin:/usr/sbin:/usr/bin)
(* Pip3 is annoying)
[root@centos8 vagrant]# which pip3
/bin/pip3
(* Change alias)
[root@centos8 vagrant]# sudo ln -s /usr/bin/pip3 /usr/bin/pip
(* Come out with pip)
[root@centos8 vagrant]# pip --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
[root@centos8 vagrant]#
Console
[root@centos8 vagrant]# dnf -y install httpd httpd-devel gcc
Displaying line numbers in vi
:set number
httpd.conf
Console
# vi /etc/httpd/conf/httpd.conf
#Line 89: Specify administrator address
ServerAdmin [email protected]
#Line 98: Uncomment and specify server name
ServerName 127.0.0.1:8000
#Line 147: Change(Remove Indexes)
Options FollowSymLinks
#Line 154: Change
AllowOverride All
#Line 167: Added if necessary(File name index that can be accessed only by directory name.php etc)
DirectoryIndex index.html
#Line 319: Confirmation (UTF)-I think it's 8, but if it's not, change it)
AddDefaultCharset UTF-8
#Added to the last line
#Server response header
ServerTokens Prod
#Keepalive on
KeepAlive On
Apply settings
[root@centos8 vagrant]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/sy
stemd/system/httpd.service.
Django3
Console
# pip install django==3.0
# django-admin --version
3.0
MySQL8
(It seems that you can only enter if you are root)
Console
# dnf module -y install mysql:8.0
# vi /etc/my.cnf.d/mysql-server.cnf
my.cnf (Addition to the bottom line results in[mysqld]Will be written in the section)
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
Console (MySQL will start after a reboot)
# systemctl enable --now mysqld
Console
# firewall-cmd --add-service=mysql --permanent
success
# firewall-cmd --reload
success
Recommended Posts