Skip to content

Prepare myOS environment in Ubuntu

Amr Aboelela edited this page Jul 8, 2023 · 139 revisions

Parent page: Prepare and install

  • Download and install Virtual Box

  • Install Ubuntu 16.04 Desktop (64-bit) from: Ubuntu

  • To run Ubuntu as a virtual machine inside Mac OSX, check on google: How to set up Ubuntu Linux on a Mac

  • Put the memory size 2GB

  • Choose "Fixed size storage" and not "Dynamically expanding storage"

  • You might want to put the size for the Hard disk to be 35 GB instead of the default value.

  • In order to be able to ssh from mac to Ubunut virtual machine:

    • Turn off Ubuntu virtual machine
    • From Main Toolbar, on the left, click Tools > Network > Create, then add Host-only adapter, then you should see vboxnet0
    • Click Settings > Network, click "Adapter 2" , click on "Enable Network Adapter", then choose Attached to: "Host-only Adapter", then click OK.
    • Click Start to restart your Ubuntu virtual machine
  • If using Ubuntu Server 16.04 then check: Static IP in VirtualBox Machine with Ubuntu 16.04

Install required packages

  • Install the following package:

      $ sudo apt-get install openssh-server 
    
  • Now from your Mac terminal, you can do ssh:

      $ sudo vi /etc/hosts
    

Added the ubuntu machine address there as, e.g.:

10.0.0.123 <machine_name>

Now ssh using:

    ~$ ssh <username>@<machine_name> 
  • If you get "Connection reset by 192.168.56.101" error then check Cant SSH localhost

  • If you have a problem with screen resolution then:

    1. Dowlonload VirtualBox Guest Additions: VirtualBox Guest Additions ISO Download
    2. Set the iso file to the Storage > Optical Drive in the VirtualBox
    3. Run the VirtualBox Guest Additions CD from the Ubuntu Virtual Machine
    4. Restart Ubuntu virtual machine.
  • Install aptitude, which will be used in installing other packages later.

$ sudo apt-get install aptitude
  • Then continue installing following packages:
sudo apt update && sudo apt upgrade
sudo aptitude -y install vim git zip python3 python3-pip postfix ffmpeg nginx letsencrypt python3-certbot-nginx
sudo ln -s /usr/bin/python3 /usr/bin/python
  • Setup git:
$ git config --global user.email "<your email>"
$ git config --global user.name "<your name>"
$ git config --global push.default simple
$ git config credential.helper store
$ git config --global credential.helper cache
$ git config --global credential.helper 'cache --timeout=3600000'

Install zsh

sudo apt install zsh
chsh -s $(which zsh) 

logout of the machine then log back in.

  • Choose option #2 to generate .zshrc file
~$ vim .bashrc
  • Add:
alias lh='ls -ltrh'
alias lha='ls -ltrha'

export EDITOR="vim"
export SWIFT_PATH=~/swift
export TWISTER_PATH=~/twister
export PATH=/opt/swift/usr/bin:/home/amr/resources/git-plus:$PATH
export LD_LIBRARY_PATH=/usr/local/lib
export GNUSTEP_MAKEFILES=/usr/share/GNUstep/Makefiles
  • Run:
~ % vi .zshrc
  • Add:
if [ -f ~/.bashrc ]; then
    . ~/.bashrc;
fi
PS1='%m %1d$ '
~ % source .zshrc

Settings

  • Set no need to put password when using sudo:

    • Run:
$ sudo visudo
  • Add:
amr ALL=NOPASSWD: ALL

ChatGPT

how to change local time zone in ubuntu to be los angeles
ssh generate key pair

Make login with ssh key instead of password

/etc/ssh % sudo vi sshd_config
  • change to:
PasswordAuthentication no
PubkeyAuthentication yes
  • remove this file:
/etc/ssh/sshd_config.d % sudo rm 50-cloud-init.conf 
.ssh % vi authorized_keys 

add id_rsa.pub keys other machines

Manual install packages

Install Noip Client

Then run this command

/usr/local/etc$ sudo chmod 777 no-ip2.conf

Make it run when system reboot, as following

~$ crontab -e

Then add

@reboot /usr/local/bin/noip2

Install resources

  • Create resources directories:
~$ mkdir archive
~$ mkdir backup
~$ mkdir resources
~$ cd resources
resources$ git clone https://github.com/tkrajina/git-plus
resources$ git clone https://github.com/amraboelela/ldb-dump

GNUstep

  • Get the source code of gnustep frameworks:

      resources$ svn co http://svn.gna.org/svn/gnustep/modules gnustep
    

Install more packages

  • Install those packages:
$ sudo aptitude install cmake clang
$ sudo aptitude install -y libz-dev libicu-dev
$ sudo aptitude install -y libffcall1-dev libffcall1 libffi-dev libxml2-dev
$ sudo aptitude install -y libtiff-dev libjpeg-dev
$ sudo aptitude install -y libx11-dev libxt-dev libxtst-dev libcairo2-dev liblcms1-dev
$ sudo aptitude install -y libgl1-mesa-dev mesa-common-dev libegl1-mesa-dev mesa-utils libgles2-mesa-dev
$ sudo aptitude install -y libxslt-dev libbsd-dev postfix mailutils

crontab

  • Here is an example to run python script through crontab:
$ crontab -e

SHELL=/bin/bash

# m h dom mon dow command
09 11 * * * source /home/amr/.bashrc; cd $APP_PATH/app-directory; python script.py

To run any process when the machine starts:

~$ crontab -e

Then add

@reboot /path/to/process

Prepare for swift:

sudo apt-get install pkg-config

Tor setup

Ask ChatGPT

how to install nginx in ubuntu
how to install letsencrypt in ubuntu with nginx

Install tor

In ChatGPT, ask:

how to generate tor onion address in my ubuntu machine
% /lib/systemd/system % sudo vi tor@default.service

Add

[Install]
WantedBy=multi-user.target
% sudo systemctl enable tor@default
Clone this wiki locally