install.md (8852B)
1 # Install Alice 2 3 This is a guide to install Alice Linux on your computer using the chroot method. You can do this from your existing Linux distribution or from a live environment, such as Alice Live or another Linux distribution. Make sure your chosen environment has the necessary partitioning tools, filesystem tools, and extraction tools. 4 5 ### Get Alice rootfs tarball 6 7 Download the Alice rootfs tarball from the [release](https://codeberg.org/emmett1/alicelinux/releases) page, along with its `sha256sum` file. 8 ``` 9 $ curl -O <url> 10 $ curl -O <url>.sha256sum 11 ``` 12 Verify the checksum of the Alice rootfs tarball: 13 ``` 14 $ sha256sum -c alicelinux-rootfs-20240525.tar.xz.sha256sum 15 ``` 16 Make sure it prints: 17 ``` 18 alicelinux-rootfs-20240525.tar.xz: OK 19 ``` 20 21 ### Prepare the partition and filesystem 22 23 Prepare the partition and filesystem of your choice. In this guide `ext4` is used as an example. 24 ``` 25 # cfdisk /dev/sdX 26 # mkfs.ext4 /dev/sdXY 27 ``` 28 Mount your created partition somewhere. In this guide `/mnt/alice` is used as the mount point. 29 ``` 30 # mkdir /mnt/alice 31 # mount /dev/sdXY /mnt/alice 32 ``` 33 34 ### Extract the Alice rootfs tarball 35 36 Extract the Alice rootfs into the mounted partition. 37 ``` 38 $ tar xvf alicelinux-rootfs-*.tar.xz -C /mnt/alice 39 ``` 40 41 ### Enter chroot 42 43 First, chroot into Alice. Replace `/mnt/alice` with your chosen mount point. 44 ``` 45 # /mnt/alice/usr/bin/apkg-chroot /mnt/alice 46 ``` 47 All further commands will be executed inside the Alice environment. 48 49 ### Clone Alice repos 50 51 Fetch the Alice packages repositories somewhere. I'll fetch them inside the `/var/lib` directory to keep the system clean. 52 ``` 53 # cd /var/lib 54 # git clone --depth=1 https://codeberg.org/emmett1/alicelinux 55 ``` 56 Once we have the repositories cloned, we need to configure `apkg`. `apkg` is the Alice package build system or package manager. By default, Alice does not provide an `apkg` config file (yes, `apkg` can work without a config file), but we will create one for ease of use. The `apkg` config file should be located at `/etc/apkg.conf` by default. 57 58 ### Configure apkg.conf 59 60 First, we set `CFLAGS` and `CXXFLAGS`. Alice base packages are built using `-O3 -march=x86-64 -pipe`. You can use these settings or change them to your preference. 61 ``` 62 # echo 'export CFLAGS="-O3 -march=x86-64 -pipe"' >> /etc/apkg.conf 63 ``` 64 And use what is in `CFLAGS` for `CXXFLAGS`. 65 ``` 66 # echo 'export CXXFLAGS="$CFLAGS"' >> /etc/apkg.conf 67 ``` 68 Next set `MAKEFLAGS`. I will use `6` for my `8 threads` machine. 69 ``` 70 # echo 'export MAKEFLAGS="-j6"' >> /etc/apkg.conf 71 ``` 72 I'm also going to set `NINJAJOBS` here. Without it, `ninja` will use all threads of your machine when compiling. 73 ``` 74 # echo 'export NINJAJOBS="6"' >> /etc/apkg.conf 75 ``` 76 Next, we need to set the package build scripts path (I'll call it `package repos`) so `apkg` can find them. The `APKG_REPO` variable can accept multiple values for multiple `package repos`. 77 78 Alice provides four (4) `package repos` (at the time of this writing): `core`, `extra`, `xorg` and `wayland`: 79 * `core` contains all base packages 80 * `extra` includes other packages beyond the base 81 * both `xorg` and `wayland` contain packages for the GUI and their dependencies. 82 83 First, get the absolute path of the `package repos` where we cloned them. By the way, we are still inside the `/var/lib` directory where we cloned the repo. 84 85 >NOTE: USE TAB COMPLETION! 86 87 ``` 88 # realpath alicelinux/repos/core 89 /var/lib/alicelinux/repos/core 90 # realpath alicelinux/repos/extra 91 /var/lib/alicelinux/repos/extra 92 ``` 93 After we have the path of our `package repos`, add it to the `APKG_REPO` variable in `/etc/apkg.conf`. 94 ``` 95 # echo 'APKG_REPO="/var/lib/alicelinux/repos/core /var/lib/alicelinux/repos/extra"' >> /etc/apkg.conf 96 ``` 97 >NOTE: All repo paths must be declared in the APKG_REPO variable, seperated by a single space. 98 99 After setting up our `package repos`, make sure `apkg` can find the packages. We can use `apkg -s <pattern>` to search for packages. 100 ``` 101 # apkg -s sway 102 swayidle 103 swaybg 104 swaylock 105 sway 106 ``` 107 If the output appears, then we are good to go. 108 109 Next, we will set up directories for `packages`, `sources`, and `work`. By default, these directories are inside the package template, but we will change them to `/var/cache/pkg`, `/var/cache/src`, and `/var/cache/work` respectively. You can change these to any location where you want to store these files. 110 111 First, create the directories: 112 ``` 113 # mkdir -p /var/cache/pkg 114 # mkdir -p /var/cache/src 115 # mkdir -p /var/cache/work 116 ``` 117 118 Then add these paths to `/etc/apkg.conf`. 119 ``` 120 # echo 'APKG_PACKAGE_DIR=/var/cache/pkg' >> /etc/apkg.conf 121 # echo 'APKG_SOURCE_DIR=/var/cache/src' >> /etc/apkg.conf 122 # echo 'APKG_WORK_DIR=/var/cache/work' >> /etc/apkg.conf 123 ``` 124 ### Full system upgrade/rebuild 125 126 On the first install, we should upgrade the system first. 127 > Use uppercase `U` for a system upgrade, and lowercase `u` to upgrade a specific package. 128 ``` 129 # apkg -U 130 ``` 131 If you changed `CFLAGS` and `CXXFLAGS` to something other than the default, it is a good time to perform a full rebuild first. In this case, you can skip upgrading the system, because performing a full rebuild will already use the latest version in `package repos`. 132 133 > Add the `-f` flag to force rebuild of the existing prebuilt package. 134 > `apkg -a` prints all installed packages on the system. 135 ``` 136 # apkg -u $(apkg -a) 137 ``` 138 ### Install development packages 139 140 Before installing any additional packages, we need to install development packages. 141 ``` 142 # apkg -I meson cmake pkgconf libtool automake perl 143 ``` 144 ### Install the kernel 145 146 You can configure your own kernel from [kernel.org](https://kernel.org/) or use the one provided by Alice. 147 > The provided kernel will take a lot of time to compile, because many options are enabled. 148 149 If you want to use Alice's kernel, just run: 150 ``` 151 # apkg -I linux 152 ``` 153 ### Install firmware 154 155 If your hardware requires firmware, install it using: 156 ``` 157 # apkg -I linux-firmware linux-firmware-nvidia 158 ``` 159 160 ### Install bootloader 161 162 In this guide, I'm going to use `grub` as the bootloader. Install `grub`: 163 ``` 164 # apkg -I grub 165 ``` 166 Then generate grub config: 167 ``` 168 # grub-install /dev/sdX 169 # grub-mkconfig -o /boot/grub/grub.cfg 170 ``` 171 172 ### Hostname 173 174 Change `alice` to the hostname of your choice. 175 ``` 176 # echo alice > /etc/hostname 177 ``` 178 179 ### File systems table Fstab 180 181 Change the partition and filesystem of your choice below: 182 ``` 183 # echo '/dev/sda1 swap swap defaults 0 1' >> /etc/fstab 184 # echo '/dev/sda2 / ext4 defaults 0 0' >> /etc/fstab 185 ``` 186 ### Enable runit services 187 188 Alice uses busybox's `runit` as its main service manager. Enable the required services: 189 ``` 190 # ln -s /etc/sv/tty1 /var/service 191 # ln -s /etc/sv/tty2 /var/service 192 # ln -s /etc/sv/tty3 /var/service 193 ``` 194 I'm enabling 3 `tty` services. `tty` is required; without it, you won't be able to log in or run any commands. 195 > The runit service directory is `/etc/sv`. 196 > Create a symlink from `/etc/sv/<service>` to `/var/service` to enable it; remove the symlink to disable it. 197 198 ### Setup user and password 199 200 Add your user: 201 ``` 202 # adduser <user> 203 ``` 204 Add your user to the `wheel` group: 205 ``` 206 # adduser <user> wheel 207 ``` 208 You might need to add your user to the `input` and `video` groups to start the Wayland compositor later, and the `audio` group to have working audio: 209 ``` 210 # adduser <user> input 211 # adduser <user> video 212 # adduser <user> audio 213 ``` 214 215 ### Root password 216 217 Set the password for the `root` user: 218 ``` 219 # passwd 220 ``` 221 222 ### Networking 223 224 You might want to set up networking before rebooting. Use `wpa_supplicant` and `dhcpcd`. 225 ``` 226 # apkg -I wpa_supplicant dhcpcd 227 ``` 228 Configure your SSID: 229 ``` 230 # wpa_passphrase <YOUR SSID> <ITS PASSWORD> >> /etc/wpa_supplicant.conf 231 ``` 232 Enable the service: 233 ``` 234 # ln -s /etc/sv/wpa_supplicant /var/service 235 # ln -s /etc/sv/dhcpcd /var/service 236 ``` 237 238 ### Timezone 239 240 Install `tzdata`: 241 ``` 242 # apkg -I tzdata 243 ``` 244 Then create a symlink for your timezone to `/etc/localtime`: 245 ``` 246 # ln -s /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime 247 ``` 248 Alternatively, you can copy it and then uninstall `tzdata` to keep your installed packages minimal: 249 ``` 250 # cp /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime 251 # apkg -r tzdata 252 ``` 253 254 ### Reboot and enjoy! 255 256 Exit the chroot environment and unmount the Alice partition, then reboot: 257 ``` 258 # exit 259 # umount /mnt/alice 260 # reboot 261 ``` 262 The machine is now ready for use. 263 264 ## Some important notes 265 266 - `Alice` uses `spm` and `apkg` as its package manager and package build system. Run with the `-h` flag to see the available options. 267 - Additional scripts are provided with the name `apkg-<script>` which will be added (or removed) from time to time. 268 - Use `revdep` to scan for broken libraries and binaries after system upgrades and package removals. You can use `revdep -v` to print out missing required libraries, and use `apkg -f -u $(revdep)` to scan and rebuild broken packages. 269 - Run `updateconf` to update config files in `/etc` after package upgrades.