第0 软件开发实现幸福人生
第43篇
Ubuntu 18.04 Install and Usage
2019年8月4日更新,共9075字
本文摘要:This article records the steps to install ubuntu 18.04.

This article records the steps to install ubuntu 18.04

1. download iso
https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/18.04

2. clear usb
(1) windows cmd.exe run as administrator
(2) diskpart
(3) list disk
(4) select disk 1
(5) list partition
(6) clean

3. write iso to usb by rufus
select freedos, iso file, mbr, fat32, click start
https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows

4. boot from usb

5. welcome : install ubuntu

6. keyboard layout: english (us)

7. updates and other software: select normal installation, check install third-party software...,
(do not check download updates while installing ubuntu, because the default source mirror might be very slow)

8. installation type: something else
a. select a partition, delete it by "-" button, so it becomes a free space,
b. setup it by click "+" button, type: primary, location: beginning, use as: ext4, mount point: /
c. select the new partition, click "change" button, check "format the partition"
d. select the new partition, click install now, then continue

9. where are you? shanghai , then wait for 5 mins

10. name: sjy, computer name: sjyubt, password: lovez, then wait for 30 mins

11. after installation, click "restart now", wait for 30 mins

12. enter password, login

13. follow the welcome to ubuntu setup procedure

14. click "software updater", "settings", select first tab "ubuntu software", click "Download from", "other ..."
select china > mirros.tuna.tsinghua.edu.cn
or click "select best server", wait for the testing, when it completes, the best server shows,
click "choose server", "close" , "reload" ,"install now", close the window

15. remove unused items from the left favorite bar, add settings, terminal to favorite, open terminal
$ sudo apt update
$ sudo apt upgrade -y
($ sudo apt install -y vino)
$ gsettings set org.gnome.Vino require-encryption false (do not use sudo here !)
$ sudo ufw allow from any to any port 5900 proto tcp

16. setup remote desktop, click the left bottom corner button, search "shar", click "sharing"
switch to "on" at the top bar,
click the "screen sharing"
switch to "on" at the dialog top bar
select require a password, set password lovefo
close the dialog by right top button

on windows, install nvcviewer, connect to ubuntu by ip_of_ubuntu:5900 and password
https://linuxconfig.org/ubuntu-remote-desktop-18-04-bionic-beaver-linux
https://itsfoss.com/update-ubuntu/

17. click the left bottom corner button, search "power", click " (settings) Power"
blank screen: 15 mins
settings > display > night light

18. click the left bottom corner button, search "visual studio", click "visual studio code", install it, add to favorite
install vetur plugin
file > preference > settings:
1. auto save: off
2. tab size : 2
3. auto closing brackets and quotes: always
4. format on paste and save: on
5. word wrap: on

19. 中文输入法
$ sudo apt install ibus-rime librime-data-wubi librime-data-pinyin-simp
setting > Region&Language, change the format from 中国 to united state,
click options button, allow different sources for each window
点+号,添加输入法 Chinese(Rime) 。如果不用其它输入法,可以删除,只保留english和rime
(解决模糊拼音,上传配置文件)

20. install tools
$ sudo apt install vim git curl
$ git clone https://github.com/SiJinmin/jianyin

21. restart , make backup for our good installation
# sudo mkdir /osbackup
# sudo mount /dev/sda4 /osbackup
# df (check disk usage)
# sudo dd if=/dev/sda2 of=/osbackup/ubuntu20190405.img bs=1G count=15 status=progress
# sudo dd if=/dev/sda of=/osbackup/ubuntu.mbr20190405.img bs=1M count=1
# ls -al /osbackup
to restore:
# sudo dd if=/osbackup/ubuntu20190405.img of=/dev/sda2 bs=1G count=15 status=progress
# sudo dd if=/osbackup/ubuntu.mbr20190405.img of=/dev/sda bs=1M count=1

22. share download folder by right click, local network share, allow guest

23. connect to ss server

Because the qt-ss provides a socks5 proxy, so you need a pac file to specify a socks5 proxy, but windows ss provide a http proxy, so you can use it directly without a pac file

[method 1]: qt-ss
(1) download the latest appimage file from
https://github.com/shadowsocks/shadowsocks-qt5/releases
https://github.com/shadowsocks/shadowsocks-qt5/releases/download/v3.0.1/Shadowsocks-Qt5-3.0.1-x86_64.AppImage
(2) make it executable by
# sudo chmod a+x Shadowsocks-Qt5-3.0.1-x86_64.AppImage
(3) double click it to execute
(4) add ss server and test the latency
(5) find or make a pac file like this
https://zaahan.us:888/files/p.js
(6) set the pac file to firefox proxy, you must use a pac file!
(7) add qt-ss to startup menu by search 'start', then add

[method 2]: windows ss
If you have a windows on your local network which runs windows ss, you can use it as a manually proxy by windows_ip:1080, no pac file needed.


24. update every sunday
# sudo apt update
# sudo apt upgrade
or
use Software Updater of ubuntu

25. Ctrl+L on file browser to switch to full path mode
Alt+` to switch in a group

26. install node and npm
# nvm install node
# npm config set registry http://registry.npm.taobao.org/

27. make a script file
```
#!/bin/bash
who="World"
echo Hello, $who!
```
$ chmod a+x lefa.sh
$ source lefa.sh
To run the script on startup:
https://linuxtechlab.com/executing-commands-scripts-at-reboot/

28. Network debug
$ sudo systemctl status/restart NetworkManager
$ ip link show
$ nmcli d

29. Remove log to release disk space
cd /var/log
sudo truncate -s 0 /var/log/syslog
sudo rm -rf kern*.log
sudo rm -rf syslog*.log
Turn off the service :
sudo systemctl stop rsyslog
sudo systemctl disable rsyslog



30. Install Mongo database
$ sudo apt install mongodb
$ mongo
> show dbs
> use admin
> db.createUser({ user: "root", pwd: "rootpw", roles: [ "root" ] }) // root user can do anything
> use lefa
> db.lefa.save( {name:"test"} )
> db.lefa.find()
> show dbs
> db.createUser({ user: "lefa", pwd: "lefapw", roles: [ { role: "dbOwner", db: "lefa" } ] }) // admin of a db
> exit
$ sudo vim /etc/mongodb.conf
auth = true
$ sudo systemctl restart mongodb
$ mongo -u "root" -p "rootpw" --authenticationDatabase "admin"
> use lefa
> db.dropUser("lefa")
> db.createUser({ user: "lefa", pwd: "lefapw", roles: [ { role: "dbOwner", db: "lefa" } ] }) // admin of a db
> exit
$ mongo -u "lefa" -p "lefapw" --authenticationDatabase "lefa"
> use lefa
> exit

backup and restore mongodb

$ mongodump --username lefa --password yourpw --db lefa --out /home/sjy/Downloads/mongodb_lefa_backups
$ mongorestore --db lefa -u lefa -p lefa_password --drop /home/sjy/Downloads/mongodb_lefa_backups/lefa

https://tecadmin.net/backup-and-restore-mongodb-database/

connection string:
mongodb://admin:admin123@example.com:27017/databasename


31. install mariadb
sudo apt-get remove mariadb-server
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.4/ubuntu $(lsb_release -cs) main"
sudo apt update
sudo apt -y install mariadb-server mariadb-client

systemctl stop mariadb
mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;
exit
sudo systemctl start mariadb


32. install kvm
https://vitux.com/how-to-install-kvm-to-create-and-manage-virtual-machines-in-ubuntu/
$ egrep -c '(svm|vmx)' /proc/cpuinfo
the output must be greater then 1
$ sudo apt install cpu-checker
$ sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
$ sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
$ sudo adduser sjy libvirt
$ groups
logout and login back
$ virsh -c qemu:///system list
search virtual in ubuntu apps, open virtual machines
$ sudo mkdir /ubt19
$ sudo mount /dev/sda3 /ubt19
https://www.techrepublic.com/article/how-to-create-virtual-machines-with-kvm/


34. convert socks5 proxy to http proxy
http://einverne.github.io/post/2018/03/privoxy-forward-socks-to-http.html
$ sudo apt install privoxy
edit /etc/privoxy/config by vscode
------------------------------------------
forward-socks5t / 127.0.0.1:1080 .
listen-address :8118
------------------------------------------
comment default 2 listen-address lines
$ systemctl restart privoxy


35. install java
https://vitux.com/your-first-java-program-in-the-ubuntu-terminal/
http://ubuntuhandbook.org/index.php/2018/05/install-oracle-java-jdk-8-10-ubuntu-18-04/
verify by:
$ java -version
$ javac -version


36. install android studio by ubuntu app search
setup proxy
https://www.cnblogs.com/jojodru/p/9713386.html
https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-android-studio-on-ubuntu-18-04-lts-bionic-beaver.html
setup real machine test
$ sudo apt install adb
$ adb devices
$ sudo usermod -aG plugdev $LOGNAME
https://blog.csdn.net/hubbybob1/article/details/90032774
add user to kvm group
https://stackoverflow.com/questions/37300811/android-studio-dev-kvm-device-permission-denied

37. start pm2 when restart
$ pm2 startup
(exe the command)
$ pm2 save
0位明友赞赏支持了本文:
我最先支持!
70%
第0 软件开发实现幸福人生
第43篇
简体版 繁體版 写评论 放大 缩小
本文已获得0条评论,被阅览3317次
©2014-2018 乐法明
愿天下父母长寿安康,愿天下子女富裕安详
联系我们:
【Email】jinmin.si@outlook.com
【微信】sidinzi
【QQ群】546445153
宣传推广
手机自适应网站开发
帮您开发像本站一样能自动适应手机、平板、PC等任意大小屏幕的网站。
您也可以直接购买一个和本站功能类似的网站,可将内容替换成您喜欢的内容。
需要的朋友请加微信号sidinzi详谈
本站广告位招商
10元/月 25元/季 80元/年
支付金额的一半会作为投资入股本站,公开发布在『贡献记』页面 上。

联系本站站长微信号:sidinzi
乞请您资助本站的发展,可通过以下任一种方式:
发微信红包到
微信号:sidinzi
发支付宝红包到
jinmin.si@outlook.com
发QQ红包到
QQ号: 914899525
Paypal转账到
jinmin.si@outlook.com
布施乐法明
您的IE浏览器版本太低,页面可能会显示不正常,建议您升级到最新版的IE,或者使用Chrome浏览器访问本站。
点击这里安装最新版的IE
关闭