alicelinux

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

install.md (9341B)


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