Ich habe CentOS 8 unter Windows 10 mit VirtualBox und Vagrant installiert

Einführung

Die Site verwendete VirtualBox und Vagrant

Referenz

Einführung der virtuellen CentOS 8-Umgebung mit VirtualBox und Vagrant (Windows 10)

Installation

Ich hatte keine besonderen Probleme So installieren Sie VirtualBox Vagrant-Installationsverfahren (Windows 10, CentOS 7.2, Vagrant 1.9.5, VirtualBox 5.1.22)

Pycharm Die Konsole verwendet normalerweise Pycharm. Festlegen von PowerShell

Der Ordner, den ich normalerweise für die Entwicklungsumgebung verwende, ist "dev", also "cd" so weit. Es gibt bereits ".vagrant" und "Vagrantfile", aber dies ist der Ergebnisbildschirm. Von nun an werden diese beiden Dateien erstellt. image.png

Ich denke, der CentOS-Download wird ungefähr 8 Minuten dauern


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

Stellen Sie vim zur Verfügung

Hat Windows vi ... und hat es "vi" ... Verwendung des Texteditors "Vim" unter Windows

Vagrantfile bearbeiten

Wichtige Änderungen Kommentar config.vm.network" forwarded_port ", Gast: 80, Host: 8080, Host_ip:" 127.0.0.1 " Geändert in config.vm.network" private_network ", IP:" 127.0.0.1 " Kommentieren Sie config.vm.synced_folder" ../ data "," / vagrant_data " aus Geändert in config.vm.synced_folder" ./ "," / var / www " config.vm.provider "virtualbox" do |vb|Und ein paar Zeilen weiterendKommentar Kommentieren Sie vb.memory =" 1024 " vb.memory =" 2048 " aus

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

Bestätigung

Oh! Ich wollte gehen. Sie können das Python-Verzeichnis richtig sehen. Ich bin froh, dass ich die vorhandene Verzeichnisstruktur nicht ändern muss (es gibt keine Regel, um sie in das vagabundierende Verzeichnis zu stellen).

Console


dev> vagrant up
dev> vagrant ssh
[vagrant@CentOS8 ~]$ cd /var/www
[vagrant@CentOS8 www]$ ls
  Arduino  Gas  Php  Portfolio  Python  Qgis  Vagrantfile  Vba

Japanisches Gebietsschema

Hinzufügen eines japanischen Gebietsschemas zur CentOS 7 Vagrant-Box von Version 1801.01

[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 (:23:00)

Wechseln Sie zum Python-Befehl

python3 → python

Console


[root@centos8 vagrant]# python3 --version
  Python 3.6.8

(* Wählen Sie 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]#

Wechseln Sie zum Befehl pip

(* Es gibt keinen 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 ist nervig)
[root@centos8 vagrant]# which pip3
  /bin/pip3

(* Alias ändern)
[root@centos8 vagrant]# sudo ln -s /usr/bin/pip3 /usr/bin/pip

(* Komm mit Pip raus)
[root@centos8 vagrant]# pip --version
  pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

[root@centos8 vagrant]#

Apache (Webserver)

Installation

Console


[root@centos8 vagrant]# dnf -y install httpd httpd-devel gcc

Anzeigen von Zeilennummern in vi


:set number

httpd.conf

Console


# vi /etc/httpd/conf/httpd.conf

#Zeile 89: Geben Sie die Administratoradresse an
ServerAdmin [email protected]
#Zeile 98: Kommentar entfernen und Servernamen angeben
ServerName 127.0.0.1:8000
#Zeile 147: Ändern(Indizes entfernen)
Options FollowSymLinks
#Zeile 154: Ändern
AllowOverride All
#Zeile 167: Bei Bedarf hinzugefügt(Dateiname, auf den nur über den Verzeichnisnamenindex zugegriffen werden kann.PHP etc.)
DirectoryIndex index.html
#Zeile 319: Bestätigung (UTF-Ich denke, es ist 8, aber wenn nicht, ändern Sie es)
AddDefaultCharset UTF-8

#Zur letzten Zeile hinzugefügt
#Server-Antwortheader
ServerTokens Prod
#Am Leben bleiben
KeepAlive On

Einstellungen übernehmen


[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

Installation

Console


# pip install django==3.0
# django-admin --version
  3.0

MySQL8

Installation

(Es scheint, dass Sie nur eingeben können, wenn Sie root sind)

Console


# dnf module -y install mysql:8.0
# vi /etc/my.cnf.d/mysql-server.cnf

my.cnf (Das Hinzufügen zum Endergebnis führt zu[mysqld]Wird im Abschnitt geschrieben)


character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8

Konsole (damit MySQL auch nach dem Neustart startet)


# systemctl enable --now mysqld

Console


# firewall-cmd --add-service=mysql --permanent
  success
# firewall-cmd --reload
  success

Recommended Posts

Ich habe CentOS 8 unter Windows 10 mit VirtualBox und Vagrant installiert
Installieren Sie Java 9 unter Windows 10 und CentOS 7
Ich habe F-Revo CRM 7.3 unter CentOS 7.7 installiert
Ich habe Docker auf EC2 installiert und gestartet
Freigeben auf der Hostseite (Windows) und der Gastseite (CentOS 7) mit VirtualBox
Ich habe eine Ubuntu-Umgebung unter Windows 10 mit WSL2 erstellt.
Ich habe versucht, YOLO v4 unter Ubuntu und ROS zu verwenden
Ich habe Squid unter CentOS in meiner lokalen Umgebung installiert
Installieren Sie Apache unter CentOS auf VirtualBox
Ich habe TinyTinyRSS unter Cent OS 8 installiert
Aktivieren Sie Openjdk10 und Maven unter CentOS
Installieren Sie Ruby 2.5 unter CentOS 7 mit SCL
Installiert auf Lombok Mac (mit STS)
Ich habe versucht, CentOS 8 unter ESXi 6.7 zu installieren
Verwenden von Docker mit Windows10 Home WSL2
Verfahren zum Installieren und Verwenden der AWS-Befehlszeile (awscli) unter CentOS
Lassen Sie uns Docker unter Windows 10 installieren und eine Überprüfungsumgebung für CentOS 8 erstellen!
Installation und japanische Lokalisierung von STS unter Windows 10
Verwenden von JupyterLab + Java mit WSL unter Windows 10
Ich habe versucht, AdoptOpenjdk 11 unter CentOS 7 zu erstellen
Wechseln Sie unter CentOS6 zwischen GUI und CUI.
Ich habe versucht, "nifty cloud mobile backend" und "Firebase" -Authentifizierung auf Kotlin + Android zu verwenden
Ich war süchtig nach RXTX mit Sierra
Ich habe versucht, Junit mit Mac VScode Maven zu verwenden
Installieren Sie Java und Android-SDK auf dem Mac mit Homebrew
HelloWorld verwendet OpenJDK unter CentOS8 nach dem Hirntod
[Android] Ich habe SQLite beendet und versucht, Realm zu verwenden
Ich habe OmniSci unter CentOS 7 + GeForce RTX 2080 Ti ausprobiert.
[Lösung] Java kann unter Windows 10 + ATOK 2017 nicht installiert werden
Ein Memorandum, wenn CentOS in VirtualBox installiert ist und Grundeinstellungen vorgenommen werden [macOS]
Eh !? Linux unter Windows ausführen? Ich kann es schaffen! !! (Ich habe WSL2 eingestellt und Ubuntu eingefügt)