asoc 安装文档备份
Posted 76 months ago linux install
Installation of AOSC OS on x86-64 systems/environments are generally universal for all systems of this architectures. But for some specific device configurations and virtualized environments, here below are some extra notes:
Forenotes
- Any commands listed below starting with a
#
means that the commands are run as theroot
user.
Choosing a Tarball
All AMD64/x86-64 tarballs are generic (universal for all supported devices), the only thing you would have to do here is choosing your favourite one - appropriate for your taste and your use case.
Note: Another consideration is whether your device is capable for a specific variant, please consult the AMD64/x86-64 system requirements page for more information.
Bootable
- Base
- KDE/Plasma
- GNOME
- MATE
- XFCE
- LXDE
- i3 Window Manager
Non-bootable
- Container
- BuildKit
We are not going to discuss the deployment of Container and BuildKit in this guide, please check for the guide in AOSC Cadet Training.
Preparing an Installation Environment
It is impossible to install AOSC OS without a working Live environment or an installed copy of Linux distribution on your local storage. Live disc images are not yet available for AOSC OS.
For installing AOSC OS, we recommend that you use GParted Live, dumped to your USB flash drive - and our guide will assume that you are using GParted Live.
Warning: Be sure that you downloaded the amd64 version, or else you won’t be able to enter AOSC OS chroot environment!
Note: You may not be able to connect to network when using VMware.
# dd if=nameofimage.iso of=/dev/sdX bs=4M
Where:
nameofimage.iso
is the filename of your downloaded GParted Live ISO file./dev/sdX
is the device file for your USB flash disk.
After you are done, boot to GParted Live.
Preparing partitions
On AMD64/x86-64, AOSC OS supports GUID (EFI) or MBR (traditional BIOS) partition tables - if you plan on multi-booting AOSC OS with other Linux distributions, Microsoft Windows, or Apple macOS, they generally uses GUID on newer machines, and MBR on older ones.
It is relatively easy to use GParted, provided with GParted Live to configure your partitions. For more details on how to configure your partition with GParted, please refer to the GParted Manual.
Extra Notes
- If you plan on installing AOSC OS across multiple partitions, please make sure you created a
/etc/fstab
file before you reboot to AOSC OS - details discussed later. - If you plan on using the ESP (EFI System Partition) as your
/boot
partition, extra actions may be needed when updating the Linux Kernel - details discussed later.
Un-tar!
With partitions configured, you are now ready to unpack the AOSC OS system tarball you have downloaded. Before you start un-tar-ing your tarball, mount your system partition(s) first. Say, if you wanted to install AOSC OS on partition /dev/sda2
:
# mount -v /dev/sda2 /mnt
Additionally, say, if you have /dev/sda3
for /home
:
# mkdir -v /mnt/home
# mount -b /dev/sda3 /mnt/home
And now, un-tar the tarball:
# cd /mnt
# tar --numeric-owner -pxf /path/to/tarball/tarball.tar.xz
For a more exciting experience, add verbosity:
# cd /mnt
# tar --numeric-owner -pxvf /path/to/tarball/tarball.tar.xz
Initial Configuration
Here below are some extra steps before you configure your bootloader - strongly recommended to avoid potential issues later.
Bind mount system/pseudo directories
# mkdir /mnt/run/udev
# for i in dev proc sys run/udev; do mount --rbind /$i /mnt/$i; done
/etc/fstab Generation
If you have chosen to use multi-partition layout for your AOSC OS installation, you will need to configure your /etc/fstab
file, one fast way to achieve this is by installing the genfstab
package:
# chroot /mnt apt update
# chroot /mnt apt install genfstab
And generate a /etc/fstab
file:
# /mnt/usr/bin/genfstab -U -p /mnt >> /mnt/etc/fstab
Chroot
Enter AOSC OS chroot environment:
# chroot /mnt /bin/bash
If you failed to enter chroot, you have probably not downloaded the amd64 version (gosh, we got it in bold as well…).
Note: Commands in all sections below are executed from chroot.
Update, Your, System!
New tarball releases comes out roughly each season (or longer depending on developers’ availability), and it is generally a wise choice to update your system first - just to get rid of some old bugs since the tarball’s release:
# apt update
# apt full-upgrade
Initialization RAM Disk
Use the following command to create initialization RAM disk for AOSC OS.
# sh /var/ab/triggered/dracut
Bootloader Configuration
Now you should be able to configure your bootloader, we will use GRUB for the purpose of this installation guide. Installation of GRUB differs for EFI and BIOS systems, and thus they will be separated to two sections.
Note: You would need GRUB 2.02 (
grub
version2:2.0.2
) to support NVMe-based storage devices as boot drives.
Note: All commands below are run from within chroot.
EFI Systems
To install GRUB for EFI systems, mount your ESP partition, generally /dev/sda1
to /efi
(change device name if appropriate):
# mount /dev/sda1 /efi
Then, install GRUB to the partition, and generate a GRUB configuration:
# grub-install --target=x86_64-efi --bootloader-id=AOSC-GRUB --efi-directory=/efi
# grub-mkconfig -o /boot/grub/grub.cfg
For some Bay Trail devices, you might need to install for i386-efi
target instead - do not use the following command unless you are sure about what you are doing:
# grub-install --target=i386-efi --bootloader-id=AOSC-GRUB --efi-directory=/efi
# grub-mkconfig -o /boot/grub/grub.cfg
BIOS Systems
Installation and configuration of GRUB is straight forward on BIOS systems, only thing to look out for is where the MBR for your hard drive(s) are. In our example, we assume that your MBR is located on /dev/sda
, but it may vary, but in most cases, MBR is located on the hard drive, but not on a partition.
# grub-install --target=i386-pc /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
User, and Post-installation Configuration
All tarballs do not come with a default user and root
user is disabled, you would have to create your own account before you reboot into AOSC OS - while leaving the password empty for the root
user - you can always use sudo
for your superuser needs.
Add a user
To add a new user aosc
, use the useradd
command:
# useradd -m -G wheel -s /bin/bash aosc
Setting password
Although it is not required to protect the newly created user aosc
with a password, it is highly recommend to do so:
# passwd aosc
Enabling Root
Although strongly discouraged, you can enable the root
user by setting a password for root
:
# passwd root
Notes: Decent Linux users need not the root user.
Setting System Timezone
Timezone info are stored in /usr/share/zoneinfo/<region>/<city>
.
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Setting System Language
AOSC OS enables all languages with UTF-8 encoding by default. In rare cases where you (really) want to disable some languages or enable non UTF-8 encodings, edit /etc/locale.gen
as needed and execute locale-gen
as root (which might take a long time).
To set default language for all users, edit /etc/locale.conf
. For example, to set system lanaguage to Chinese Simplified (China):
LANG=zh_CN.UTF-8
Notes: After you rebooted the computer into the new system, you may use the
localectl
command to do this:
# localectl set-locale "LANG=zh_CN.UTF-8"
Setting System Hostname
To set a hostname for the system, edit /etc/hostname
. For example, to set the hostname to be MyNewComputer:
MyNewComputer
Notes: After you rebooted the computer into the new system, you may use the
hostnamectl
command to do this:
# hostnamectl set-hostname yourhostname