<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: zstg</title>
    <description>The latest articles on DEV Community by zstg (@zstg).</description>
    <link>https://dev.to/zstg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F607359%2F0c79e1c0-1e04-41a0-8040-30f6da37bb23.jpg</url>
      <title>DEV Community: zstg</title>
      <link>https://dev.to/zstg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zstg"/>
    <language>en</language>
    <item>
      <title>Set up Arch Linux in WSL</title>
      <dc:creator>zstg</dc:creator>
      <pubDate>Tue, 12 Apr 2022 07:39:04 +0000</pubDate>
      <link>https://dev.to/zstg/set-up-arch-linux-in-wsl-12n0</link>
      <guid>https://dev.to/zstg/set-up-arch-linux-in-wsl-12n0</guid>
      <description>&lt;h2&gt;
  
  
  Install Arch Linux on WSL
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Download the latest version of ArchWSL from &lt;a href="https://github.com/yuk7/archwsl/releases" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;NOTE: I've saved the folder as &lt;code&gt;ArchLinux&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Extract the archive &lt;/li&gt;
&lt;li&gt;Run the following command &lt;em&gt;in PowerShell&lt;/em&gt; to install ArchWSL:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;D:\&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Expand-Archive&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\ArchLinux.zip&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="n"&gt;D:\ArchLinux\Arch.exe&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F69384921%2F158779592-379e8947-cf52-47ac-8057-ac0794fc257d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F69384921%2F158779592-379e8947-cf52-47ac-8057-ac0794fc257d.png" alt="Screenshot 2022-03-17 145954"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done ! Arch is now installed &lt;em&gt;as a custom distro&lt;/em&gt; on WSL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Init keyring and populate the pacman database
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a new user with sudo privileges&lt;/li&gt;
&lt;li&gt;Run the following command &lt;em&gt;in PowerShell&lt;/em&gt; to boot your distro for the first time:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wsl -d ArchLinux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should open up a bash terminal, and execute some &lt;em&gt;refreshing-key...&lt;/em&gt;-like commands...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "%wheel ALL=(ALL) ALL" &amp;gt; /etc/sudoers.d/wheel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command added in the sudoers file ensures that all the members of the &lt;code&gt;wheel&lt;/code&gt; group can execute any command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pacman -Syy archlinux-keyring
pacman-key --init
pacman-key --populate
pacman -Syy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will update the pacman database, using the ArchLinux keyring.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a new sudo user
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;READ  &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Enter the username: "&lt;/span&gt; username
useradd &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="nb"&gt;users&lt;/span&gt; &lt;span class="nt"&gt;-G&lt;/span&gt; wheel &lt;span class="nt"&gt;-s&lt;/span&gt; /bin/bash &lt;span class="nv"&gt;$username&lt;/span&gt;
passwd &lt;span class="nv"&gt;$username&lt;/span&gt;
su &lt;span class="nv"&gt;$username&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This asks the user the new password as input, and then creates the user with the specified username.&lt;/p&gt;

&lt;h2&gt;
  
  
  SystemD
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="nt"&gt;-O&lt;/span&gt; &lt;span class="s2"&gt;"https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x install.sh
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./install.sh &lt;span class="nb"&gt;install
sudo&lt;/span&gt; /opt/distrod/bin/distrod &lt;span class="nb"&gt;enable 
sudo rm&lt;/span&gt; ./install.sh
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;----------------------------------------------------------------------------------------------------------&lt;/span&gt;
&lt;span class="nb"&gt;echo &lt;/span&gt;Now terminate this distro and open a new shell!
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;----------------------------------------------------------------------------------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;curl&lt;/code&gt; is a command line tool for transferring files from or to a remote server. It can be used to download files from website links, just like what we have done in the previous step.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chmod&lt;/code&gt; is a command line tool for changing the file permissions of files and directories.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;echo&lt;/code&gt; is a command line tool for printing strings to the standard output.&lt;/p&gt;

&lt;p&gt;NOTE: You have to set your user as the default user on ArchLinux.&lt;/p&gt;

&lt;p&gt;Do this by running &lt;code&gt;/path/to/arch.exe config --set-default-user &amp;lt;username&amp;gt;&lt;/code&gt;.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
