安裝ubuntu系統
- 參考以下步驟進行安裝
- http://blog.sciencenet.cn/blog-892035-1083295.html
- 其中注意以下幾個問題:
- 製作安裝U盤時,使用universal-usb-installer製成的啟動U盤無法正常啟動,使用UltraISO製作的可以正常
- 啟動,UltraISO製作過程參考:
- https://blog.csdn.net/fu6543210/article/details/79722615
安裝和開啟SSH服務
- 系統安裝後,默認是沒有安裝和開啟SSH服務的,安裝和開啟過程如下:
- sudo apt-get install openssh-server
- sudo service ssh start
- 按上述步驟安裝和開啟後,默認情況下SSH是開機自啟動的,不需要再額外進行配置
- https://www.cnblogs.com/EasonJim/p/7189509.html
批量創建用戶和設置密碼
- 編寫shell腳本用於批量創建用戶,並且設置統一密碼為123,其中要創建的用戶名存放於文件users.txt中
- 腳本如下:
#!/bin/bash
# usage:
# ./add-multi-user.sh users.txt
# sudo useradd -m -s /bin/bash <user_name>
for user_name in `cat $1`
do
echo $user_name
# -m: specify to create default home directory
# -s: specify the default shell to bash
sudo useradd -m -s /bin/bash $user_name
# set default password as “123”
echo “$user_name:123” | sudo chpasswd
done
- users.txt內容如下:
user1
user2
user3
安裝和批量配置samba服務
- 安裝
- sudo apt-get install samba
- 備份smb.conf
- sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
- 編寫shell腳本進行配置,待創建的用戶仍存於users.txt,腳本內容如下:
#!/bin/bash
for user_name in `cat $1`
do
echo config samba for $user_name …
# config smb.conf
echo “
[$user_name]
path = /home/$user_name
browseable = yes
writable = yes
valid users = $user_name
” | sudo tee -a /etc/samba/smb.conf
# add smb password for the user
echo -ne “123\n123\n” | sudo smbpasswd -a -s $user_name
echo “config success for $user_name”
echo
done
# restart samba service
sudo service smbd restart
- 參考:
- https://blog.csdn.net/wbaction/article/details/72758673
批量添加sudo用戶
- 一個簡單而快捷的方式為:
- sudo usermod -aG sudo <username>
- 利用上述基本命令,批量添加的腳本如下(同時包括了force color prompt的修改):
#!/bin/bash
for user_name in `cat $1`
do
echo “add sudoer for $user_name”
sudo usermod -aG sudo $user_name
# force color prompt in login shell
sudo sed -i ‘s/#force_color_prompt/force_color_prompt/g’ /home/$user_name/.bashrc
done
安裝和配置git
- 安裝很簡單
- sudo apt-get install git
- 與git伺服器的交互配置
- 把舊伺服器下用戶主目錄下的.ssh拷貝至新的用戶主目錄下即可
- 其他git的配置根據自己的情況自定義,如user和mail等
- 安裝和配置post review
- 下載對應系統python版本的RBTools工具(egg文件,系統python版本可以通過執行python看到,ubuntu 16.04 下默認為Python 2.7.12)
- https://downloads.reviewboard.org/releases/RBTools/0.4/RBTools-0.4.3-py2.7.egg#md5=c28da8a7f961982958b89a2d17d2bbdf
- 安裝python setup tools
- sudo apt-get install python-setuptools
- 安裝RBTools的egg文件
- easy_install RBTools-0.4.3-py2.7.egg
- 安裝完畢後,在用戶home目錄下,配置review board用戶和密碼
cat .reviewboardrc
## Current Repository ##
#REPOSITORY = “/home/disk/cameo-src/icore”
## User Configuration ##
USERNAME = “zhifu”
PASSWORD = “123456”
## Review Board Settings ##
REVIEWBOARD_URL = “http://172.22.102.205”
- 配置IP地址、子網掩碼、網關和DNS server等
- sudo vim /etc/network/interfaces
- 在後面添加(其中eth0為要添加的網卡名稱)
auto eth0
iface eth0 inet static
address 172.22.102.221
netmask 255.255.255.0
gateway 172.22.102.250
dns-nameservers 172.22.93.28 172.22.111.2 114.114.114.114
- 修改網卡名稱為eth0
sudo vim /etc/default/grub
GRUB_CMDLINE_LINUX=””
改為
GRUB_CMDLINE_LINUX=”net.ifnames=0 biosdevname=0″
執行
sudo grub-mkconfig -o /boot/grub/grub.cfg
vim /etc/network/interfaces
- 更改原有網卡名稱為eth0
- 比如,在原有的內容之後添加eth0(假定配置的IP為192.168.101.111):
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.101.111
netmask 255.255.255.0
gateway 192.168.101.1
dns-nameservers 172.22.93.28 172.22.111.2 114.114.114.114
- 設置網卡開機自啟動
- sudo systemctl enable networking.service
- 重啟系統
- 參考:
- http://blog.51cto.com/270142877/2047563
- https://blog.csdn.net/wenwenxiong/article/details/52937539
64位環境下運行32位程序
- 得益於ubuntu系統的multiarch支持,我們可以在64位系統下運行相應的32位程序
- 添加32位程序multiarch支持(16.04下默認支持):
- sudo dpkg –add-architecture i386
- 為32位架構添加庫支持(“:i386″後綴表示是32位庫),當出現類似庫的問題時,都可以通過這種方式來安裝32位的庫
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install libncurses5-dev:i386
sudo apt-get install zlib1g-dev:i386
原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/220758.html