- Установка alpine linux virtualbox
- Obtain installer ISO
- Setup VM
- Basic Alpine Linux Install
- Remove CD
- Update Packages
- Setup User and Sudo
- Setup VirtualBox Drivers
- Test
- SSH
- References
- Alpine Install: from a disc to a virtualbox machine single only
- Terminology
- Requirements
- Preparing the medium to install
- Preparing the virtual machine to install
- Booting the Alpine ISO disc
- Finishing the installation
Установка alpine linux virtualbox
My current use for this VM is to run ansible. I use SSH to access the VM (both for running commands and transferring files), so don’t bother running a GUI on it, or shared folders.
This document was tested with VirtualBox v5.0.20 r106931, running under Windows 7, and installing AlpineLinux v3.3.3 x64. It is assumed that VirtualBox is already installed.
Obtain installer ISO
Go to the downloads section of https://alpinelinux.org/ and download the 64-bit «Standard ISO» — I got alpine-3.3.3-x86_64.iso — save it somewhere you can find it again.
Setup VM
- Start VirtualBox, and click [New] to create a new VM.
- Set the name as suits you, set Type=»Linux», Version=»Linux 2.6 / 3.x / 4.x (64bit)», click [Next].
- Set Memory size to 256MB, click [Next].
- Select «Create a new virtual hard disk» and click [Create].
- Select «VDI» and click [Next].
- Select «Dynamically allocated» and click [Next].
- Set size to 2GB and click [Create].
The blank machine should now be created, and will be listed in the VirtualBox window, on the left. Right-click on the machine and choose «Settings». Configure as follows:
- System > Motherboard
- Base Memory = 256MB
- Boot Order = Optical, Hard Disk (untick Floppy)
- Pointing Device = PS/2 Mouse
- Hardware clock in UTC Time
- Video Memory = 1MB
- NOTE: VirtualBox will complain about this, but I’m planning to connect via ssh, so will not be using any appreciable amount of video ram.
- in the Storage Tree, select the CD just under «Controller IDE»
- in the Attributes section, click on the CD icon at the far right.
- Choose Virtual Optical Disk File and select your ISO (alpine-3.3.3-x86_64.iso)
- disable
- Adapter1 attached to: NAT
- Click the blue triangle to expand «Advanced» settings, then click [Port Forwarding]
- In the top-right corner, click the green symbol with the «+» on it
- Name = «SSH»
- Protocol = «TCP»
- Host Port = «22022» (or whatever suits you)
- Guest Port = «22»
- click [OK]
- disable
- disable
Basic Alpine Linux Install
Run «setup-alpine», and configure as follows:
- keyboard layout = «us»
- keyboard variant = «us»
- system hostname = whatever suits you
- initialise interface: «eth0»
- «dhcp»
- no manual setup
- enter root password, as desired.
- timezone: «Pacific/Auckland» (or whatever suits you)
- HTTP/FTP proxy URL: [none]
- Detect and add fastest mirror (f)
- SSH server: «openssh»
- NTP client: «chrony»
- install to disk: «sda»
- install type: «sys»
- erase & continue? Y
Now run «poweroff» to shutdown the VM — this is necessary in order to reboot into the installed system, so we can install things there.
Remove CD
In the main VirtualBox window, right-click on the machine and choose «Settings». Reconfigure as follows:
- Storage
- in the Storage Tree, select the CD just under «Controller IDE».
- in the Attributes section, click on the CD icon at the far right.
- Choose «Remove disk from virtual drive», and click OK.
Update Packages
Start the VM. When it has finished booting, the login prompt should show the hostname you selected (instead of «localhost»). Login as «root», using the password you setup.
Use vi to edit the repositories — uncomment all the URL lines to enable them all.
It should look something like this (but probably different URLs, depending on which ones were detected as being fastest for you):
#/media/cdrom/apks http://dl-6.alpinelinux.org/alpine/v3.3/main http://dl-6.alpinelinux.org/alpine/v3.3/community http://dl-6.alpinelinux.org/alpine/edge/main http://dl-6.alpinelinux.org/alpine/edge/community http://dl-6.alpinelinux.org/alpine/edge/testing
Update the package list and upgrade what has already been installed:
The base install at this stage will have used about 25MB of the boot partition (nominally about 100MB, but 92.8MB reported), 512MB as swap, and 270MB of the root partition — if the base disk was 2GB, about 1GB is free on the root drive.
Setup User and Sudo
Create the sudo group, create a non-root user (use whatever username you like, instead of «otheruser»), and add the new user to the sudo group:
addgroup sudo adduser otheruser adduser otheruser sudo
Run «visudo» and remove the «#» comment character from the 2nd line in this group so it looks like:
## Uncomment to allow members of group sudo to execute any command %sudo ALL=(ALL) ALL
Setup VirtualBox Drivers
The VirtualBox drivers improve performance of a VM running under VirtualBox.
apk add virtualbox-guest-modules-grsec virtualbox-additions-grsec
Reboot the VM by typing «reboot».
Test
You should now be able to login as the non-root user you created (using the non-root password you provided).
Once logged in, you should be able to execute commands as root by using sudo (and the non-root user password), eg. «sudo apk update» — if sudo is not working correctly, it will give an error, eg. if you weren’t using sudo at all:
testvm:~$ apk update ERROR: Unable to lock database: Permission denied ERROR: Failed to open apk database: Permission denied
If sudo is working correctly, the command will execute, eg.:
testvm:~$ sudo apk update fetch http://dl-6.alpinelinux.org/alpine/v3.3/main/x86_64/APKINDEX.tar.gz fetch http://dl-6.alpinelinux.org/alpine/v3.3/community/x86_64/APKINDEX.tar.gz fetch http://dl-6.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz fetch http://dl-6.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz fetch http://dl-6.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz v3.3.3-46-ge9c0256 [http://dl-6.alpinelinux.org/alpine/v3.3/main] v3.3.3-47-g150c9b2 [http://dl-6.alpinelinux.org/alpine/v3.3/community] v160223-1826-g4681e7d [http://dl-6.alpinelinux.org/alpine/edge/main] v160223-1826-g4681e7d [http://dl-6.alpinelinux.org/alpine/edge/community] v160223-1826-g4681e7d [http://dl-6.alpinelinux.org/alpine/edge/testing] OK: 15131 distinct packages available
SSH
It should also be possible to SSH from the host machine to the VM at address «localhost» (or «127.0.0.1»), and port «22022»
References
Alpine Install: from a disc to a virtualbox machine single only
Overall description: Installing Alpine from an official disc image to a VirtualBox machine.
This document guides you through installing Alpine on a VirtualBox VM — this is ideal if you only want to try out Alpine.
Terminology
- Host machine: the machine you’re running VirtualBox on. It will «host» the target virtual machine.
- Guest machine: your target machine where Alpine will be installed, executed by the VirtualBox software on the host machine.
- Reserved RAM: the amount of host machine RAM that will be needed for exclusive use by the guest machine. The host machine cannot use this RAM while the guest machine is running.
- Virtual disc: the emulated storage medium attached to the guest machine. Usually it is a file (or several files) which VirtualBox presents as a disk to the guest OS (Alpine).
Requirements
- VirtualBox
- At least 1GB of RAM, 2GB or more is recommended
- Some means to download the install image (wget, curl, web browser)
Preparing the medium to install
Download the source medium to install and put into your home; there’s more hardware medium sources to download, like the s390x and ppc64le, but because VirtualBox handles only x86 and x64 hardware, we will list those here
The name of the source medium to install will be in the following format: http://dl-cdn.alpinelinux.org/alpine/v/releases//alpine-standard-.0-.iso where ARCH and VERSION can be one of the following, for VirtualBox virtual machines:
- can be
- x86: The well known i386 to i686. (32-bit machines)
- x86_64: The popular AMD64 compatible 64-bit x86 based machines.
- latest-stable as the name says, the latest, stable version
- 3.10 UEFI support began with this version
- 3.8 recommended for machines manufactured between 2012 and 2016
- 3.6 recommended for older machines
Typically, the version most commonly used in a virtual box is the x86. The hardware is cheaper and operation does not consume a lot of memory. The iso download URL format is:
Graphical download: Just point the web browser to that URL and the download will start. A file with .iso extension type, with a name like «alpine-standard-3.10.0-x86.iso» (if i386/686); will be downloaded into the directory specified in your browser configuration.
Command line method: just open a terminal and execute: wget -c -t8 —no-check-certificate http://dl-cdn.alpinelinux.org/alpine/v/releases//alpine-standard-.0-.iso , for example:
wget -c -t8 —no-check-certificate http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86/alpine-standard-3.10.0-x86.iso
You must be mindful of the directory you run the command from, as that is where the file will be saved.
Preparing the virtual machine to install
Start the VirtualBox software program.
- In the main window create a new virtual machine by clicking the blue spark New button. That will open a new window with the following questions:
- It will ask for a name for the virtual like «alpine-desktop-try1».
- The Type of the Operating system choose «linux».
- The version choose «other linux». It must match the chosen (e.g. x86).
- Click the «Next» button to continue creating the virtual machine.
- When selecting the amount of RAM for the virtual machine, choose a minimum of 512MB then click the «Next» button.
- A new window with a Hard disk assistant will open.
- First choose «Create a virtual hard disk now» then click the «Create» button.
- Next choose the option for hard disk type: VDI and push «Next» button.
- Choose dynamically allocated then click the «Next» button.
- The next window will offer the size of virtual disk. 4GB, however, you may choose a different amount of storage space.
- After clicking on «Create» the virtual machine will be ready to use.
- Now the main window shows you the «alpine-desktop-try1» virtual machine, select it.
- Click on the yellow «Configuration» button. Go to the storage menu and pull it down.
- Select the disc drive icon for CD/DVD ROM and click on the CD/DVD drive icon at the right.
- A Mini menu will open. Select an external file event the host CD/DVD drive.
- A file open dialog will open. Search for the downloaded Alpine iso and select it.
- Once you choose the iso file to boot, click the «Ok» button to finish creating the virtual machine.
- Click the green «Start» arrow to start the virtual machine and boot the iso.
Booting the Alpine ISO disc
When the machine starts, you must be sure to choose the Optical drive (commonly named CD/DVD ROM drive), so the disc/iso will boot. After a while, a command line shell will show you
TODO restore the inclusion of template inclkude pages here, were edited and now does not have any sense respect this guide..
Finishing the installation
After setup ends, a «reboot» will be offered. Type «reboot» and press enter and your newly installed virtual machine will be booted. Don’t forget to remove the boot medium.
You cannot see a graphical window system? No problem. With Alpine, GUIs are made the right way. So if you need a desktop, you can install a desktop.