alicelinux

A lightweight musl + clang/llvm + libressl + busybox distro
git clone https://codeberg.org/emmett1/alicelinux
Log | Files | Refs | README | LICENSE

install.md (9290B)


      1 Install Alice
      2 =============
      3 
      4 Here is a guide to installing 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.
      5 
      6 Get Alice rootfs tarball
      7 ------------------------
      8 
      9 Download the Alice rootfs tarball from the [release](https://codeberg.org/emmett1/alicelinux/releases) page, along with its `sha256sum` file.
     10 ```
     11 $ curl -O <url>
     12 $ curl -O <url>.sha256sum
     13 ```
     14 
     15 Verify the checksum of the Alice rootfs tarball:
     16 ```
     17 $ sha256sum -c alicelinux-rootfs-20240525.tar.xz.sha256sum
     18 ```
     19 
     20 Make sure it prints:
     21 ```
     22 alicelinux-rootfs-20240525.tar.xz: OK
     23 ```
     24 
     25 Prepare the partition and filesystem
     26 ------------------------------------
     27 
     28 Prepare the partition and filesystem of your choice. In this guide, I will use `ext4` as an example.
     29 ```
     30 # cfdisk /dev/sdX
     31 # mkfs.ext4 /dev/sdXY
     32 ```
     33 
     34 Mount your created partition somewhere. In this guide, I will use `/mnt/alice` as the mount point.
     35 ```
     36 # mkdir /mnt/alice
     37 # mount /dev/sdXY /mnt/alice
     38 ```
     39 
     40 Extract the Alice rootfs tarball
     41 --------------------------------
     42 
     43 Extract the Alice rootfs into the mounted partition.
     44 ```
     45 $ tar xvf alicelinux-rootfs-*.tar.xz -C /mnt/alice
     46 ```
     47 
     48 Enter chroot
     49 ------------
     50 
     51 First, chroot into Alice. (Replace `/mnt/alice` with your chosen mount point)
     52 ```
     53 # /mnt/alice/usr/bin/apkg-chroot /mnt/alice
     54 ```
     55 
     56 Any further commands after this will be executed inside the Alice environment. 
     57 
     58 Configure apkg.conf
     59 -------------------
     60 
     61 Once we have the repositories cloned, we need to configure `apkg`. `apkg` is Alice's 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 need to create one. The `apkg` config file should be located at `/etc/apkg.conf` by default. Let's create one. 
     62 
     63 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.
     64 ```
     65 # echo 'export CFLAGS="-O3 -march=x86-64 -pipe"' >> /etc/apkg.conf
     66 ```
     67 
     68 And use whats in `CFLAGS` for `CXXFLAGS`.
     69 ```
     70 # echo 'export CXXFLAGS="$CFLAGS"' >> /etc/apkg.conf
     71 ```
     72 
     73 Next set `MAKEFLAGS`. I will use `6` for my `8 threads` machine.
     74 ```
     75 # echo 'export MAKEFLAGS="-j6"' >> /etc/apkg.conf
     76 ```
     77 
     78 I'm also going to set `NINJAJOBS` here. Without it, `ninja` will use all threads of your machine when compiling.
     79 ```
     80 # echo 'export NINJAJOBS="6"' >> /etc/apkg.conf
     81 ```
     82 
     83 Next, we need to set the package's 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`.
     84 
     85 Alice provides two (2) `package repos` (at the time of this writing): `core` and `extra`. `core` contains all base packages, and `extra` includes other packages beyond the base.
     86 
     87 I'm gonna use directory `/var/lib/repos/core` and `/var/lib/repos/extra` for `core` and `extra` repos respectively.
     88 ```
     89 # echo 'APKG_REPO="/var/lib/repos/core /var/lib/repos/extra"' >> /etc/apkg.conf
     90 ```
     91 
     92 > NOTE: All repo paths must be declared in the APKG_REPO variable, separated by a single space.
     93 
     94 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.
     95 
     96 First, create the directories:
     97 ```
     98 # mkdir -p /var/cache/pkg
     99 # mkdir -p /var/cache/src
    100 # mkdir -p /var/cache/work
    101 ```
    102 
    103 Then add these paths to `/etc/apkg.conf`.
    104 ```
    105 # echo 'APKG_PACKAGE_DIR=/var/cache/pkg' >> /etc/apkg.conf
    106 # echo 'APKG_SOURCE_DIR=/var/cache/src' >> /etc/apkg.conf
    107 # echo 'APKG_WORK_DIR=/var/cache/work' >> /etc/apkg.conf
    108 ```
    109 
    110 Configure reposync.conf
    111 -----------------------
    112 
    113 `reposync` is a tool to sync package templates from git repositories. Add remote repos for `core` and `extra` into `/etc/reposync.conf`. The format of remote repos in `reposync.conf` is `<gitrepo>|<branch>|<localpath>`.
    114 ```
    115 # echo 'https://codeberg.org/emmett1/alicelinux|core|/var/lib/repos/core' >> /etc/reposync.conf
    116 # echo 'https://codeberg.org/emmett1/alicelinux|extra|/var/lib/repos/extra' >> /etc/reposync.conf
    117 ```
    118 
    119 Now run `reposync` to sync latest package templates.
    120 ```
    121 # reposync
    122 ```
    123  
    124 After setting up our `package repos`, make sure `apkg` can find the packages. We can use `apkg -s <pattern>` to search for packages.
    125 ```
    126 # apkg -s sway
    127 swayidle
    128 swaybg
    129 swaylock
    130 sway
    131 ```
    132 
    133 Lets combine with `-p` flags to show path or package templates.
    134 ```
    135 # apkg -p $(apkg -s sway)
    136 /var/lib/repos/extra/sway
    137 /var/lib/repos/extra/swaylock
    138 /var/lib/repos/extra/swaybg
    139 /var/lib/repos/extra/swayidle
    140 ```
    141 
    142 If the output appears, then we are good to go.
    143 
    144 Full system upgrade/rebuild
    145 ---------------------------
    146 
    147 On the first install, we should upgrade the system first.
    148 
    149 Before we do, install development packages first.
    150 ```
    151 # apkg -I meson cmake pkgconf libtool automake perl
    152 ```
    153 
    154 > NOTE: use upppercase 'i' for solve dependencies, lowecase 'i' without solve dependencies.
    155 
    156 Now lets upgrade our system.
    157 ```
    158 # apkg -U
    159 ```
    160 
    161 > NOTE: Use uppercase `U` for a system upgrade, and lowercase `u` to upgrade a specific package of your choice.
    162 
    163 If you changed `CFLAGS` and `CXXFLAGS` to something other than the default, it's 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`.
    164 ```
    165 # apkg -u $(apkg -a)
    166 ```
    167 
    168 > NOTE: Add the `-f` flag to force rebuild of existing prebuilt package.
    169 > NOTE: `apkg -a` prints all installed packages on the system.
    170 
    171 Install kernel
    172 --------------
    173 
    174 You can configure your own kernel from [kernel.org](https://kernel.org/) or use the one provided by Alice.
    175 
    176 > NOTE: The provided kernel will take a lot of time to compile because many options are enabled.
    177 
    178 If you want to use Alice's kernel, just run:
    179 ```
    180 # apkg -I linux
    181 ```
    182 
    183 Install firmware
    184 ----------------
    185 
    186 If your hardware requires firmware, install it using:
    187 ```
    188 # apkg -I linux-firmware
    189 ```
    190 
    191 Install bootloader
    192 ------------------
    193 
    194 In this guide, I'm going to use `grub` as the bootloader. Install `grub`:
    195 ```
    196 # apkg -I grub
    197 ```
    198 
    199 Then generate grub config:
    200 ```
    201 # grub-install /dev/sdX
    202 # grub-mkconfig -o /boot/grub/grub.cfg
    203 ```
    204 
    205 Hostname
    206 --------
    207 
    208 Change `alice` to the hostname of your choice.
    209 ```
    210 # echo alice > /etc/hostname
    211 ```
    212 
    213 Fstab
    214 -----
    215 
    216 Change the partition and filesystem of your choice below:
    217 ```
    218 # echo '/dev/sda1 swap swap defaults 0 1' >> /etc/fstab
    219 # echo '/dev/sda2 / ext4 defaults 0 0' >> /etc/fstab
    220 ```
    221 
    222 Enable runit services
    223 ---------------------
    224 
    225 Alice uses busybox's `runit` as its main service manager. Enable the required services:
    226 ```
    227 # ln -s /etc/sv/tty1 /var/service
    228 # ln -s /etc/sv/tty2 /var/service
    229 # ln -s /etc/sv/tty3 /var/service
    230 ```
    231 
    232 I'm enabling 3 `tty` services. `tty` is required; without it, you won't be able to log in (or run any commands).
    233 
    234 > The runit service directory is `/etc/sv`.
    235 > Create a symlink from `/etc/sv/<service>` to `/var/service` to enable it; remove the symlink to disable it.
    236 
    237 Setup user and password
    238 -----------------------
    239 
    240 Add your user:
    241 ```
    242 # adduser <user>
    243 ```
    244 
    245 Add your user to the `wheel` group:
    246 ```
    247 # adduser <user> wheel
    248 ```
    249 
    250 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:
    251 ```
    252 # adduser <user> input
    253 # adduser <user> video
    254 # adduser <user> audio
    255 ```
    256 
    257 Root password
    258 -------------
    259 
    260 Set the password for the `root` user:
    261 ```
    262 # passwd
    263 ```
    264 
    265 Networking
    266 ----------
    267 
    268 You might want to set up networking before rebooting. Use `wpa_supplicant` and `dhcpcd`.
    269 ```
    270 # apkg -I wpa_supplicant dhcpcd
    271 ```
    272 
    273 Configure your SSID:
    274 ```
    275 # wpa_passphrase <YOUR SSID> <ITS PASSWORD> >> /etc/wpa_supplicant.conf
    276 ```
    277 
    278 Enable the service:
    279 ```
    280 # ln -s /etc/sv/wpa_supplicant /var/service
    281 # ln -s /etc/sv/dhcpcd /var/service
    282 ```
    283 
    284 Timezone
    285 --------
    286 
    287 Install `tzdata`:
    288 ```
    289 # apkg -I tzdata
    290 ```
    291 
    292 Then create a symlink for your timezone to `/etc/localtime`:
    293 ```
    294 # ln -s /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
    295 ```
    296 
    297 Alternatively, you can copy it and then uninstall `tzdata` to keep your installed packages minimal:
    298 ```
    299 # cp /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
    300 # apkg -r tzdata
    301 ```
    302 
    303 Reboot and enjoy!
    304 -----------------
    305 
    306 Exit the chroot environment and unmount the Alice partition, then reboot:
    307 ```
    308 # exit
    309 # umount /mnt/alice
    310 # reboot
    311 ```
    312 
    313 Some important notes
    314 ====================
    315 
    316 - `Alice` uses `spm` and `apkg` as its package manager and package build system. Run with the `-h` flag to see available options.
    317 - Additional scripts are provided with the name `apkg-<script>` which will be added (or removed) from time to time.
    318 - 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.
    319 - Run `updateconf` to update config files in `/etc` after package upgrades.