Jump to content

Configure-Ubuntu

From altctrlarcade

Install Ubuntu Server

Download an ISO, use Rufus to install it to a flash drive (over 4gb probably)- install to a target machine.

1. credentials:

  1. user: admin
  2. password: *********

2. update packages when logging in. This will all require an internet connection.

sudo apt update && apt upgrade 

install I3wm (Minimal Window Manager)

  1. sudo apt install i3
  2. install xorg (for x-windows session environment.)
    1. sudo apt install xorg
  3. Then we need to tell X to use I3wm:
    1. echo "exec i3" >> ~/.xinitrc
    2. your xinitrc is also the file we’ll configure later.
  4. then we run an x session:
    1. startx
    2. This will open our x session, which will run I3wm.
  5. Do you want to generate a config?
    1. defaults to /home/dev/.config/i3/config
    2. for your default modifier, i suggest “Win” (your super key)

Great! you have ubuntu running, you have I3wm managing your windows. some quick shortcuts:

Key Action
Super + Enter Open Terminal
Super + D launch an application
Super + F Full screen switch
Super + Shift + Q Close a window (super important to remember this one when testing.)
Super + shift + E Exit I3 session. this is super useful since you’ll make the game boot on start- if you ever need to close the game to configure the OS, you may want to quit the game, then quit the i3 session.

By default, I3WM has many shortcuts for windowmanagement. This makes sense because it’s primary purpose is to be a configurable window manager. In our case, we want to configure it to remove stuff, so that it appears to just be a game running with no GUI or anything else.

/etc/profile configuration (Start X/I3 when logging in)

You’ll find that when the computer reboots, your x session doesn’t magically start, you have to run it every time it boots. We will add a script that executes our X session when we log into TTY1 (default)

  1. Open our user profile: /etc/profile file-
    1. sudo nano /etc/profile
  2. And Add this snippet to the end of it:

<syntaxhighlight lang="bash">

   if "$(tty)" == '/dev/tty1' ; then
       exec startx
   fi

</syntaxhighlight>

This will start our X session when tty1 logs in. This doesn’t enable autologin yet.

Users- Admin / Player

When our computer starts, we don’t want the player to be running in an administrative mode. We will want to create a “Player” user which only has permission to run our build. #todo: ADD DOCUMENTATION.

Getting your game running

There are some basic things to do when setting up the game, and when you add new builds to your machine. You need to make it part of a specific user group (for security!) and make it playable.

  1. Extract Game to a location
    1. #todo Extrapolate on where the build should go
    2. take a note of the location of your game.
  2. Add build to correct user group.
    1. #todo Extrapolate on adding to specific groups
  3. Make the build playable
    1. cd (change directory) to the folder where you placed the build.
      1. EG: cd ~/Downloads/
    2. sudo chmod +x BUILDNAME.x86_64
      1. chmod +x is the same as right clicking on your file and setting “Allow executing as a program”
  4. Run the build to test that it works:
    1. ./BUILDNAME.x86_64

Run the game when we Login (Modifying XinitRC)

if you remember from above, xinitrc (X init file) is what we use to run i3. It is also what we’ll use to run our program.

  1. Open Our XinitRC file again
    1. your xinitrc file is usually in your home directory. (cd ~/)
    2. sudo nano .xinitrc
  2. Add functions to run your game
exec i3 # this was already here if you followed the instructions above.
& sleep 1 # adds a second between loading I3 with the game
exec /URL/TO/BUILD.x86_64 #example: exec ~/Build/MyGame.x86_64
  1. The full URL is mandatory here- remember where you unzipped it.
  2. Save (Ctrl + S), Exit (Ctrl + X)

This will now be run when when your session starts. note that pressing Super+Shift+Q will not only close the game- it will also close the session.

Please Note!

You may want to do this part last since it means you can’t log in and modify stuff very easily. If you have already done this, another way to access your profile is by logging into TTY2+. This means pressing “Ctrl + Alt + F2/3/…” will allow you to switch to another terminal. Since our Xsession only starts on TTY1, we can safely work in another session without loading I3 or our build.

automatically Log in when computer starts.

This is important since you don’t expect a login screen when a computer starts. It can be a little more involved than it seems. Since we’re running Ubuntu Server, we don’t have a “display manager”- so we can’t just configure one. We’ll have to do it with SystemD:

To add a New Login Service

  1. sudo systemctl edit getty@tty1.service
    1. This will automatically create a service file and open it in an editor (nano)
  2. add:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin myusername %I 38400 linux
Type=idle

Make sure to Change $username to your username! (Eg: ‘Player’, if you’ve added a player account. otherwise, just the username you’ve been using.) 1. Save (Ctrl + S), Exit (Ctrl + x)

  1. Enable Start of the service
    1. systemctl enable getty@tty1.service

Please Note!

Since you are now creating a loop: Computer On -> Login to Session -> Run I3 -> Run Game, when you Quit I3, you’ll be brought back to the “login” screen, however that will in turn Autologin once again. See the above note about changing to a different terminal (TTY2 for example) in order to make changes.

Remove the I3 Bar at the bottom.

Optionally, if you don’t want to see the Status bar at the bottom of the screen for the exactly 1 second that it shows between logging in and running the game, you can configure I3 to hide it.

  1. Open the I3 Config
    1. sudo nano .config/i3/config
    2. This is our i3 Configuration. There are many options we can do here- and if you’re interested, i encourage you to read more about configuring I3 to change the default keybinds, etc.
  2. Add the Code for removing the Bar
    1. At the Bottom, locate the script that says: bar { status_command i3status}
    2. replace it with:
bar {  
mode invisible  
}

If you reload I3, or restart, you’ll see that the bar doesn’t show up now.