From charlesreid1

Line 69: Line 69:
~/.ssh/authorized_keys
~/.ssh/authorized_keys
</pre>
</pre>
Now verify that SSHing into the Ubuntu server will not ask you for a password.


==Configure WPA Supplicant==
==Configure WPA Supplicant==

Revision as of 00:32, 4 July 2020

All the setup involved for bespin, a Ubuntu 18.04 desktop server.

Setup

Aptitude update

During installation, we allow setup to join the wifi network. On first boot, the network manager will be running and will be connected to the same wifi network. We will disable network manager eventually, but first get some software.

sudo apt-get update
sudo apt-get -y install vim gnome-tweak-tool net-tools

Set caps lock as a control key.

Allow sudo for user

Create wheel group:

sudo groupadd wheel

Add user to group:

sudo usermod -a -G wheel <your-username-here>

Allow wheel group users passwordless sudo, first use visudo to edit the sudoers file:

EDITOR=vi visudo

Now add this line to the end:

%wheel ALL=(ALL) NOPASSWD: ALL

Install ssh

Install ssh and server:

sudo apt-get install ssh

Start the server:

sudo service ssh start

Install trusted ssh key

If you want, set up a machine to securely SSH into the Ubuntu server.

From the machine you want to SSH FROM:

cat ~/.ssh/id_rsa.pub

Copy this text. Now in another terminal, ssh into the Ubuntu server. Paste the output of the above command into the file:

~/.ssh/authorized_keys

Now verify that SSHing into the Ubuntu server will not ask you for a password.

Configure WPA Supplicant

We want to configure wifi manually, and disable the network manager. This requires some preparation to manually join a wifi network with wpa supplicant.

First set your wpa supplicant to join a wifi network.

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="yournetworkhere"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="yourpskhere"
}

Next add the 2 usb wifi devices to network interfaces file. The following etc network interfaces file assumes that wlan0 will be joining an existing wifi network, and wlan1 will be in manual mode so it can be used as an AP.

/etc/network/interfaces

allow-hotplug wlan0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet dhcp

allow-hotplug wlan1
iface wlan1 inet static
    address 192.168.10.1
    netmask 255.255.255.0
    gateway 192.168.10.1

except actually the iface names were dependent on the mac addresses of the wifi cards.

WPA Supplicant Startup Service

Copy a wpa supplicant service template:

sudo cp /lib/systemd/system/wpa_supplicant.service /etc/systemd/system/wpa_supplicant.service

Edit the file

sudo vim /etc/systemd/system/wpa_supplicant.service

Change this line from this:

ExecStart=/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant

to this:

ExecStart=/sbin/wpa_supplicant -u -s -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlan0

Also, remove the following line if it is present:

Alias=dbus-fi.w1.wpa_supplicant1.service # DELETE ME!

Now enable this service to start on boot:

sudo systemctl enable wpa_supplicant.service

Dhclient on Startup

Create an rc.local startup service:

/etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Now add the dhclient command to rc.local:

/etc/rc.local

#!/bin/bash
/sbin/dhclient
exit 0

Make it executable:

chmod 744 /etc/rc.local

Now enable the rc-local service:

sudo systemctl enable rc-local.service

Verify it works okay:

sudo systemctl start rc-local.service
sudo systemctl status rc-local.service

Requesting Static IP

If you want to request a static IP from the router, add this to the dhclient config file:

/etc/dhcp/dhclient.conf

interface "wlan0" {
     send dhcp-requested-address 192.168.0.122;
}

Disable Network Manager

Next step is to disable the network manager.

sudo systemctl disable network-manager
sudo systemctl stop network-manager

Don't uninstall it, because that will uninstall a bunch of other important gnome packages and you'll be left with a stupid broken ubuntu.

Now reboot

sudo reboot now

Test Wifi

Test that everything is working as expected by running the ifconfig and iwconfig commands. ifconfig should show an IP address for the wlan0 interface that has the wpa supplicant defined in the network interfaces file. iwconfig should show the name of the wifi network that the wifi card is connected to.

If you don't have an IPv4 address, troubleshoot with the following commands:

Check if you can reach the internet:

ping google.com

Check logs from dhcp service started by rc.local (this gets an IP address from the router and is the most likely culprit):

sudo service rc-local status

Check logs from wpa supplicant:

sudo service wpa_supplicant status

Tweaking Gnome

Tweak the theme. You already have Tweak tool installed (see above apt-get install line).

Install Macbuntu Theme

Set it up to look like a mac by installing the macbuntu theme - see http://www.linuxandubuntu.com/home/macbuntu-transform-ubuntu-1604-to-mac-os-x

sudo add-apt-repository ppa:noobslab/macbuntu
sudo apt-get update
sudo apt-get install macbuntu-os-icons-v1804
sudo apt-get install macbuntu-os-ithemes-v1804

Pick Tweak Theme

Now you can open the Tweak tool and pick the Macbuntu theme.

Install Plank

Plank is a dock replacement.

Install it like so:

sudo apt-get install plank
sudo add-apt-repository ppa:noobslab/macbuntu
sudo apt-get update
sudo apt-get install -y macbuntu-os-plank-theme-v1804

Start it at boot by creating the following file:

mkdir -p ~/.config/autostart

~/.config/autostart/plank.desktop

[Desktop Entry]
Type=Application
Exec=plank
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Plank

To open Plank preferences, right-click on the right or left side of the Plank dock and choose Preferences.

Disable Launcher

Do this to disable the ubuntu-provided launcher dock:

cd /usr/share/gnome-shell/extensions/
sudo mv ubuntu-dock@ubuntu.com{,.bak}

If you can't wait to see it go, type Alt + F2, then enter the letter "r" in the input box. This will refresh gnome.

Install Albert

Albert is a spotlight/quicksilver replacement.

Install it like so:

sudo add-apt-repository ppa:noobslab/macbuntu
sudo apt-get update
sudo apt-get install -y albert


Start it at boot by creating the following file:

~/.config/autostart/albert.desktop

[Desktop Entry]
Type=Application
Exec=albert
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Albert

Test with Restart

Restart and test that the startup services start okay:

sudo reboot now