本指南適用於Ubuntu,但也與其他基於Debian的操作系統兼容,例如Mint,Elementary OS等。
還有其他版本的配置,例如20.04,18.04,16.04,15.10
測試了所有命令/配置(我當前正在使用此配置),但是無論如何,您所做的一切都是“自身風險”。
如果您發現任何問題,請在問題頁面上或通過電子郵件[email protected]告訴我
(返回到頂部)
lsb_release -a
lsb_release -as # Short Information
lsb_release -sc # OS Codename
lsb_release --help
sudo dmidecode -t processor
或者
nproc # How many Processing Units
cpuid # Must install cpuid from terminal
cat /proc/cpuinfo # Lots of info
sudo lshw -C display
sudo dmidecode -t baseboard
sudo dmidecode -t bios
free -h # Human readable, or do --help for options
top or htop # Must install htop
vmstat -s
cat /proc/meminfo # Lots of info
磁盤空間
df
df -B MB # In Megabtyes, etc
或安裝ncdu並運行
ncdu /
磁盤空間分析儀
sudo baobab
磁盤UUID
ls -al /dev/disk/by-uuid/
gnome-system-monitor
您可以通過在終端中輸入以下命令來確定哪種服務需要多少時間才能完成:
systemd-analyze blame
總體啟動時間您可以通過以下方式找到:
systemd-analyze time
列出所有已安裝的軟件包
dpkg -l
僅列出明確安裝的軟件包
aptitude search '~i!~M'
從終端運行以下屏幕截圖:
gnome-screenshot
延遲5秒
gnome-screenshot --delay 5
延遲5秒,只有窗口
gnome-screenshot -w --delay 5
要更改GNOME-SCREENSHOT的默認保存目錄,請使用命令
gsettings set org.gnome.gnome-screenshot auto-save-directory "file:///home/$USER/Pictures/"
awk '{print $1*10^-6 " W"}' /sys/class/power_supply/BAT0/power_now
另外,您可以安裝powertop以列出每個過程的消耗。
sudo apt install powertop
首次使用之前,您可能需要校準powertop 。對於校準,運行:
sudo powertop --calibrate
gsettings list-recursively org.gnome.desktop.wm.keybindings | sort | more
查看您的關鍵:
xev
或有關許多細節:
xev | grep KeyPress
如果願意,您可以使用32位應用程序,有時這很有用。
sudo apt update && sudo apt install -y unetbootin
要啟用網絡,並使Windows等所有計算機都可以訪問它,請首先安裝Samba:
$ sudo apt install -y samba
然後編輯Samba配置:
$ vim /etc/samba/smb.conf
在[global]下,將工作組更改為您使用的內容,默認值為工作組:
workgroup = WORKGROUP
然後,您將必須重新加載會話。
如果您正在運行GRUB作為默認啟動加載程序,則可以使用此應用程序來更容易更改訂單。
sudo add-apt-repository -y ppa:danielrichter2007/grub-customizer
sudo apt update && sudo apt install -y grub-customizer
加載應用程序<Super> ,並查找GRUB定制器或終端gksudo grub-customizer 。
轉到General Settings選項卡,您將看到默認條目。
打開 /etc /fstab
sudo vim /etc/fstab
添加到/etc/fstab此行(您可以通過命令ls -al /dev/disk/by-uuid/ )獲得磁盤uuid:
對於NTFS磁盤:
UUID=[DISK UUID] /media/D ntfs-3g defaults,windows_names,locale=en_US.utf8 0 2
對於Ext4磁盤:
UUID=[DISK UUID] /media/D ext4 defaults 0 2
運行後
sudo mount -a
打開 /etc /fstab
sudo vim /etc/fstab
並添加:
如果需要授權:
username@remote_address:/remote/path /local/path fuse.sshfs delay_connect,_netdev,idmap=user,uid=1000,gid=1000,noatime,default_permissions,IdentityFile=/home/<user>/.ssh/id_rsa,reconnect,transform_symlinks,allow_other 0 0
如果不需要:
//remote_address/remote/path /local/path cifs guest,iocharset=utf8,uid=1000,gid=1000,file_mode=0777,dir_mode=0777,noperm,_netdev 0 0
運行後
sudo mount -a
安裝先決條件
sudo apt install -y python3 python3-appdirs python3-dateutil python3-requests python3-sqlalchemy python3-pip
安裝acd_cli(https://github.com/yadayada/acd_cli)
cd ~ && sudo pip3 install --upgrade git+https://github.com/yadayada/acd_cli.git
啟動“同步”,該“同步”將啟動瀏覽器(Chrome/lynx/etc)向Amazon.com啟動並設置OAuth鍵。
acd_cli sync
複製/粘貼並存儲您的OAuth數據。注意:它很可能會出現不當的紐線休息時間。在您喜歡的文本編輯器中進行修復。
vim ~/.cache/acd_cli/oauth_data
將用戶添加到“保險絲”組中以允許安裝
sudo addgroup <username> fuse
將Amazon Cloud Drive的根部安裝到 /媒體 /Amazon目錄
mkdir /media/amazon
acd_cli mount /media/amazon
上傳
-d exclude duplicate files from upload
-x upload threads
例如,將本地 /媒體 /視頻目錄上傳到Amazon Cloud Drive的根部。
acd_cli upload -d -x 4 /media/videos /
ssh-keygen -t rsa -C "[email protected]"
ssh [email protected] (default port is 22)
ssh [email protected] -p 8000 (connect to specific port)
ssh [email protected] -i ~/.ssh/id_rsa (connect with specific ssh key)
chmod 700 ~/.ssh
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/known_hosts
chmod 600 ~/.ssh/authorized_keys
您還可以創建一個〜/.ssh/config文件和存儲條目,例如:
Host aws
Hostname host.amazonaws.com
Port 22
Identityfile ~/.ssh/id_rsa
User myusername
Host my-vps
Hostname 34.16.67.129
Port 22
User root
然後,您可以簡單地鍵入:
ssh aws
ssh my-vps
有時您可能需要PEM格式SSH鍵。您可以輕鬆地將其與其他SSH鍵一起添加。
openssl rsa -in ~/.ssh/keyname_rsa -outform pem > keyname_rsa.pem
chmod 700 keyname_rsa.pem
打開終端和類型:
gpg --gen-key
GPG現在將詢問有關要生成的密鑰類型的許多問題。請按照以下步驟每次選擇默認選項。
檢查您的密鑰是否已通過鍵入生成
gpg --list-secret-keys --keyid-format LONG
而且,如果成功
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid Hubot
ssb 4096R/42B317FD4BA89E7A 2016-03-10
在您的.bashrc中添加變量
export GPGKEY=3AA5C34371567BD2
gpg --output gpg.asc --export -a $GPGKEY
gpg --send-keys --keyserver keyserver.ubuntu.com $GPGKEY
您可以在http://keyserver.ubuntu.com/上檢查鍵
要配置您的git客戶端以默認為本地存儲庫簽名,在git Versions 2.0.0及更高版本中
git config --global user.signingkey {YOUR KEY}
git config commit.gpgsign true
要默認在計算機上的任何本地存儲庫中籤署所有提交,請運行
git config --global commit.gpgsign true
如果您想手動簽名:
git commit -S -m "commit message"
如果要使用GUI客戶端進行投入,則必須在~/.gnupg/gpg.conf文件中添加一些選項
no-tty
use-agent
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
# or, instead of backing up trustdb...
gpg --export-ownertrust > ownertrust-gpg.txt
cp /path/to/backups/*.gpg ~/.gnupg/
# or, if you exported the ownertrust
gpg --import-ownertrust ownertrust-gpg.txt
如果您只是複制了.gnupg文件夾,則應註冊鍵:
gpg --import pubring.gpg
gpg --import secring.gpg
檢查是否得到硬件的支持
egrep -c '(vmx|svm)' /proc/cpuinfo
如果0表示您的CPU不支持硬件虛擬化。
如果1或更多,則仍然需要確保在BIOS中啟用虛擬化。
要檢查是否已啟用,您可以執行:
kvm-ok
如果您有KVM,則會看到:“信息:您的CPU支持KVM擴展信息: /dev /kvm存在KVM加速度,可以使用”
安裝必要的軟件包
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
如果您遇到了錯誤:libdvd-pkg: apt-get check失敗,則包裹可能損壞。流產...
您必須運行sudo dpkg-reconfigure libdvd-pkg ,然後重試。
接下來,將您的用戶添加到KVM組和Libvirtd組中。為此,輸入:
sudo adduser `id -un` libvirt
sudo adduser `id -un` kvm
驗證安裝:
virsh list --all
輸入sudo模式
sudo su
列出可用的磁盤並檢測其安裝位置: /dev /sd [1個字母] [可選的1個數字]。例如, /dev /sdc或 /dev /sdc1
fdisk -l
或者
lsblk
卸載驅動器
umount /dev/sd[1 letter][optionally 1 number]
格式為FAT32
mkfs.vfat /dev/sd[1 letter]
您可以將mkfs.ntfs用於NTF,MKFS.ext4用於Ext4等。
彈出驅動器
eject /dev/sd[1 letter]
列出可用的磁盤並檢測其安裝位置: /dev /sd [1個字母] [可選的1個數字]。例如, /dev /sdc或 /dev /sdc1
fdisk -l
或者
lsblk
如果您想在USB上寫入Windows ISO,請使用以下方法:Linux上的Windows ISO的USB Maker
確保USB設備已卸載(不安全地卸下,但要卸載),如果安裝它,則可以卸載它:
sudo umount /dev/sd[1 letter][optionally 1 number]
用於編寫圖像運行:
sudo dd bs=4M if=path/to/your/iso/file.iso of=/dev/sd[that 1 letter]
安裝genisoimage
sudo apt install -y genisoimage
跑步後
geteltorito -o dest.img source.iso
您必須安裝HPLIP軟件。在https://developers.hp.com/hp-linux-imaging-and-printing上了解更多信息
sudo apt install hplip hplip-gui
查找安裝的HP應用程序並運行。
您可以通過BIOS信息命令查看BIOS版本
通過sudo apt install genisoimage
轉到support.lenovo.com(或更好地使用搜索引擎,因為Lenovo網站很醜)並蒐索筆記本電腦型號的BIOS升級。
下載最新的ISO文件。查找“ BIOS可啟動更新CD”。
通過genisoimage -o bios.img g2uj18us.iso將.ISO轉換為.img格式,將ISO映像轉換為IMG格式
將任何USB插入筆記本電腦中插入。圖像文件的尺寸僅約50 MB,因此即使容量較低的USB棒也可以工作。請記住,棍子將被完全覆蓋。
如果您在圖形環境中,請卸載USB棒。
找出棍棒的設備名稱。例如/dev/sdb (通過sudo fdisk -l顯示設備)。不要只是假設它是SDB。如果它在筆記本電腦上的另一個設備上,則將破壞數據。
將圖像複製到USB棒: sudo dd if=bios.img of=/dev/sdb bs=1M
重新啟動筆記本電腦,然後按F12從棍棒上啟動設備。
確保您的筆記本電腦插入電源。 (否則將拒絕更新。)
按照說明進行操作。
BetterCap是一種功能強大,靈活和便攜式工具,可實時對網絡,操縱HTTP,HTTPS和TCP流量進行各種類型的MITM攻擊,嗅探憑據等等。完整的文檔https://www.bettercap.org
安裝依賴項
sudo apt install -y build-essential ruby-dev libpcap-dev
並安裝BetterCap
sudo gem install bettercap
您可以通過
sudo bettercap --sniffer
安裝paprefs軟件包
sudo apt install -y paprefs
轉到PulseAudio Preferences ,並在Simultaneous Output卡上查看Add virtual output device for simultaneous output on all local sound cards
此後重新啟動脈衝
pulseaudio -k
然後轉到您的聲音設置,您將看到輸出到多個聲音設備的選項。
將文件ps.sh放在/etc/profile.d目錄下。
在〜/.bashrc和/root/.bashrc文件中添加行:
source /etc/profile.d/ps.sh
安裝cpufrequtils並設置州長
sudo apt install -y cpufrequtils
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
sudo systemctl restart cpufrequtils
禁用默認ondemand總督:
sudo systemctl disable ondemand
您可以通過
cpufreq-info
或者:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
以下步驟將顯示您運行一個示例bash腳本,該腳本報告/home目錄的磁盤空間使用情況,並每次Ubuntu System啟動時將報告保存在/root目錄中。
在/usr/local/bin/中創建shell腳本以在啟動時運行。
vim /usr/local/bin/disk-space-check.sh
以下是此類腳本的一個示例:
#! /bin/bash
date > /root/disk_space_report.txt
du -sh /home/ >> /root/disk_space_report.txt在/etc/systemd/system/文件夾下創建SystemD服務文件。
sudo vim /etc/systemd/system/disk-space-check.service
並放置內容:
[Unit]
After=network.service
[Service]
ExecStart=/usr/local/bin/disk-space-check.sh
[Install]
WantedBy=multi-user.target
設置適當的許可:
sudo chmod 744 /usr/local/bin/disk-space-check.sh
sudo chmod 664 /etc/systemd/system/disk-space-check.service
啟用服務單元:
sudo systemctl daemon-reload
sudo systemctl enable disk-space-check.service
Systemd有用的命令:
systemctl list-units --type=service列表現有服務systemctl list-units --type=target列表可能的目標systemctl list-dependencies <name>.target列表依賴項對於更現代化的系統(> 1GB),您的交換空間應至少等於您的物理內存(RAM)大小“如果使用Hibernation”,否則最少需要圓形(SQRT(RAM)),最多是RAM的兩倍。擁有比實際使用的交換空間更多的唯一缺點是您將為它保留的磁盤空間。您可以在這裡閱讀更多。
檢查交換
cat /proc/swaps
交換參數控制內核將過程從物理內存中移出並轉移到交換磁盤上的趨勢。由於磁盤比RAM慢得多,因此,如果過程過於積極地移出內存,則可以導致系統和應用程序響應時間較慢。
Ubuntu中的默認設置為交換= 60。減少交換的默認值可能會改善典型的Ubuntu桌面安裝的整體性能。建議使用= 10的值,但可以隨意進行實驗。
檢查交換價值
cat /proc/sys/vm/swappiness
以10的交換價值為10,可以用10來改變交換價值
sudo vim /etc/sysctl.conf
並添加/編輯行
vm.swappiness=10
假設您的字體在~/Download/Fonts下
要添加這些字體,您必須運行:
sudo mkdir /usr/share/fonts/truetype/custom
sudo mv /home/longman/Downloads/Fonts/*.TTF /usr/share/fonts/truetype/custom
sudo mkdir /usr/share/fonts/opentype/custom/
sudo mv /home/longman/Downloads/Fonts/*.otf /usr/share/fonts/opentype/custom
要清除緩存,請運行:
fc-cache -rv
(返回到頂部)
登錄到Linux用戶,然後轉到您的主目錄,
cd ~
運行這些命令並根據需要調整它們。 -y標誌在沒有提示的情況下安裝。從終端運行這些命令。
sudo apt update && sudo apt upgrade
在下面的類別中提供了PPA,我強烈建議您使用PPA或至少安裝此軟件包,以防您使用它們。
啟用規範合作夥伴存儲庫
sudo add-apt-repository -y "deb http://archive.canonical.com/ $(lsb_release -sc) partner" && sudo apt update
Flatpak是用於在Linux上構建和分發桌面應用程序的下一代技術
sudo apt install -y flatpak gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
並重新啟動系統。
這是為了調整UI
sudo apt update && sudo apt install -y
gnome-tweak-tool
chrome-gnome-shell
gnome-shell-extensions
dconf-editor
synaptic
您可以檢查您的VGA信息
在https://www.nvidia.com/en-us/geforce/geforce/drivers/上找到適合您圖形卡的正確驅動程序版本
安裝NVIDIA驅動程序
sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt update && sudo apt install -y nvidia-driver-XXX
鍵入您的版本xxx
然後從驅動程序選項卡中選擇安裝的驅動程序後
sudo software-properties-gtk
卸下NVIDIA驅動程序
sudo add-apt-repository -r ppa:graphics-drivers/ppa
編輯NVIDIA設置;在Global Launcher (超鍵/Windows鍵)中鍵入以下內容:
nvidia settings
NVIDIA®CUDA®工具包為創建高性能GPU加速應用提供了一個開發環境。
該工具包包括GPU加速庫,調試和優化工具,C/C ++編譯器以及用於部署應用程序的運行時庫。
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
sudo add-apt-repository -y "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt update
sudo apt -y install cuda
要安裝ATI驅動程序,請閱讀此官方文檔:http://support.amd.com/en-us/kb-articles/pages/amdgpu-pro-install.aspx
安裝實用程序:
sudo apt install -y vim git mercurial meld curl htop xclip unzip gdebi preload bleachbit ubuntu-restricted-extras cifs-utils unace unrar zip p7zip-full
p7zip-rar sharutils rar openssh-server lm-sensors whois traceroute nmap font-manager sshfs mc libavcodec-extra libdvd-pkg nfs-kernel-server openvpn
easy-rsa network-manager-openvpn-gnome exfat-fuse apt-transport-https ethtool net-tools dos2unix
liblz4-tool network-manager-openconnect-gnome network-manager-fortisslvpn-gnome openfortivpn tree duplicity screen lib32z1
libglib2.0-dev-bin pv software-properties-common cpu-checker libnss3-tools python3-pip libcanberra-gtk-module sshpass jq libfuse2 libxi6 libxrender1
libxtst6 mesa-utils libfontconfig libgtk-3-bin tar dbus-user-session libminizip1 libgdk-pixbuf-xlib-2.0-0 libgdk-pixbuf2.0-0 libopenal-data libopenal1
libsndio7.0 gnome-shell-extension-manager bpytop ca-certificates-java cargo clang clang-18 default-jdk default-jdk-headless default-jre default-jre-headless
fonts-dejavu-extra icu-devtools java-common lib32gcc-s1 lib32stdc++6 libatk-wrapper-java libatk-wrapper-java-jni libc6-x32 libclang-common-18-dev libclang-rt-18-dev
libgit2-1.7 libhttp-parser2.9 libice-dev libicu-dev libobjc-13-dev libobjc4 libpfm4 libsm-dev libstd-rust-1.75 libstd-rust-dev libxml2-dev libxt-dev libz3-4 libz3-dev
linux-headers-generic llvm-18 llvm-18-dev llvm-18-linker-tools llvm-18-runtime llvm-18-tools openjdk-21-jdk openjdk-21-jdk-headless openjdk-21-jre openjdk-21-jre-headless
p7zip python3-gpg python3-ldb python3-markdown python3-psutil python3-samba python3-talloc python3-tdb rustc samba-common samba-common-bin samba-dsdb-modules putty-tools
設置GIT默認值
git config --global user.name "your name"
git config --global user.email "[email protected]"
這將與以下方式創建一個~/.gitconfig
[user]
email = [email protected]
name = your name
Ubuntu 20.04帶有新的深色主題選項,但這還不夠。
在設置中>外觀選擇窗口顏色為深色。
“問題”源於新的“黑暗”設置只會改變桌面上運行的應用的外觀。它不會改變桌面UI本身的顏色。要解決此問題,請安裝用戶主題GNOME SHELL EXTENSION和GNOME調整工具:
sudo apt install -y gnome-shell-extensions gnome-tweak-tool
打開Gnome擴展應用程序,然後將“用戶主題”旁邊的切換滑到ON。
重新啟動Gnome shell(alt + f2,type r,命中輸入)
最後,打開GNOME調整工具,然後在側邊欄中選擇“外觀”,找到外殼部分,然後從相鄰的菜單中選擇Yaru Dark 。
從https://www.oracle.com/java/technologies/javase-jdk15-downloads.html下載並安裝DEB軟件包
並更新替代方案
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-15.0.1/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-15.0.1/bin/javac 1
sudo update-alternatives --config java
運行Windows應用程序是最佳選擇。我經常將Heidisql與葡萄酒一起使用。
啟用i386架構
sudo dpkg --add-architecture i386
下載並添加存儲庫密鑰:
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
添加存儲庫:
sudo add-apt-repository -y 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
安裝:
sudo apt update && sudo apt install -y --install-recommends winehq-stable
使用Nautilus-Actions輕鬆且圖形地創建Ubuntu的Nautilus文件管理器的自定義上下文菜單選項。
sudo add-apt-repository -y ppa:daniel-marynicz/filemanager-actions
sudo apt install -y filemanager-actions-nautilus-extension
安裝後,請使用以下命令退出並重新啟動Nautilus文件管理器。您也可以按Alt+F2並鍵入此命令,而不是在終端中運行它。
nautilus -q
安裝後,您可以啟動fma-config-tool 。
您還可以安裝一些Nautilus擴展名
sudo apt install -y nautilus-admin nautilus-meld nautilus-checksum-menu
Hardinfo是Linux的珠穆朗瑪峰/AIDA替代方案。它顯示系統信息
sudo apt install -y hardinfo
咖啡因是使用全屏窗口時暫時防止屏幕保護程序 /鎖定屏幕 /睡眠模式激活的工具。如果您使用的是不自動執行此操作的視頻播放器,在聽音樂時,該應用程序很有用。
sudo apt install -y caffeine
注意:安裝後,咖啡因的命令行版本設置為在登錄時自動啟動。如果您希望指示器自動啟動,則必須在啟動應用程序中添加“咖啡因 - 探測器”。
屏幕是一個全屏窗口管理器,它在幾個過程(通常是交互式外殼)之間多路復用物理終端。每個虛擬終端都提供DEC VT100終端的功能,此外,ANSI X3.64(ISO 6429)和ISO 2022標準(例如,插入/刪除行和支持多個字符集)的幾個控制函數。每個虛擬終端都有一個滾動記錄緩衝區,並且有一個複制和貼上機制,該機制使用戶可以在Windows之間移動文本區域。當屏幕被稱為屏幕時,它將創建一個帶有外殼(或指定命令)的單個窗口,然後避開您的方式,以便您可以像往常一樣使用程序。然後,您可以隨時使用其中的其他程序(包括更多的外殼)創建新的(全屏)窗口,殺死當前窗口,查看活動窗口的列表,打開和關閉輸出登錄,在Windows之間複製文本,在Windows之間複製文本,查看滾動記錄,在Windows之間進行切換,在Windows之間進行切換等。所有Windows都完全獨立於他們的程序。當目前看不到其窗口時,即使整個屏幕會話都與用戶終端分離時,程序仍將繼續運行。
sudo apt install -y screen
快速,高度可自定義的系統信息腳本
Neofetch是用Bash編寫的CLI系統信息工具。 NeoFetch顯示有關您的系統的信息,您選擇的圖像,OS徽標或任何ASCII文件。 NeoFetch的主要目的是用於屏幕截圖,以向其他用戶展示您正在運行的操作系統,您使用的主題/圖標等。
安裝:
sudo apt install -y neofetch
圖形管理磁盤分區的分區編輯器https://gparted.sourceforge.io/
sudo apt install -y gparted
UFW或簡單的防火牆是Iptables的接口,旨在簡化配置防火牆的過程。雖然iptables是一種堅實而靈活的工具,但對於初學者來說,很難學習如何使用它來正確配置防火牆。 UFW默認是在Ubuntu上安裝的。如果由於某種原因卸載了它,您可以將其安裝
sudo apt install -y ufw
要啟用UFW,請使用此命令:
sudo ufw enable
配置示例:
要配置服務器以允許傳入的SSH連接,您可以使用此命令:
sudo ufw allow ssh
但是,我們實際上可以通過指定端口而不是服務名稱來編寫等效規則。例如,此命令與上面的命令相同:
sudo ufw allow 22
例如,要允許使用端口6000-6007的X11連接,請使用以下命令:
sudo ufw allow 6000:6007/tcp
sudo ufw allow 6000:6007/udp
GUFW是UFW的GUI
sudo apt install -y gufw
從https://www.geekbench.com/download/linux/下載檔案。
在 /OPT下移動文件夾
sudo mv Geekbench-5.3.1-Linux /opt/geekbench5
現在您可以運行基準
/opt/geekbench5/geekbench5
Clonezilla是一個分區和磁盤成像/克隆程序。它可以幫助您進行系統部署,裸機備份和恢復。
下載實時USB映像:https://clonezilla.org/downloads/download.php?branch=stable
準備USB設備
mkfs.vfat -F 32 /dev/sd[1 letter]
並將ISO圖像寫給USB
這是一個測試CRT/LCD屏幕質量的程序。它顯示了各種模式,並允許您估計CRT/LCD顯示器的質量。
sudo apt install -y screentest
Ventoy是為ISO/WIM/IMG/VHD(X)/EFI文件創建可引導USB驅動器的開源工具。使用Ventoy,您無需一遍又一遍地格式化磁盤,您只需要將ISO/WIM/IMG/VHD(X)/EFI文件複製到USB驅動器並將其直接啟動即可。您可以一次復制許多文件,而Ventoy將為您提供啟動菜單以選擇它們。
從此處下載安裝程序包,例如Ventoy-XXXX-Linux.tar.gz並進行解壓縮。將shell腳本作為root運行,其中xxx是USB設備,例如 /dev /sdb:
sudo sh Ventoy2Disk.sh -i -L "MY-USB" /dev/XXX
注意將要格式化USB驅動器,並且安裝後所有數據將丟失。
您只需要一次安裝Ventoy,然後所有需要的就是將ISO文件複製到USB。您也可以將其用作普通的USB驅動器來存儲文件,這不會影響Ventoy的功能。
您可以在USB驅動器上使用配置文件/ventoy/ventoy.json配置Ventoy的工作方式。
我的配置文件看起來像:
{
"control" : [
{ "VTOY_DEFAULT_SEARCH_ROOT" : " /install/iso " }
],
"theme" : {
"display_mode" : " CLI "
}
}您可以在這裡找到完整的文檔
(返回到頂部)
添加Google Chrome存儲庫並安裝
sudo sh -c 'echo "deb [arch=amd64] http://dl-ssl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt update && sudo apt install -y google-chrome-stable
然後以$ google-chrome啟動它,您可以將其固定在侏儒酒吧中。
通過快照安裝:
sudo snap install firefox
安裝
sudo apt install playonlinux
安裝
sudo apt install nautilus-dropbox
代碼,標記和散文的複雜文本編輯器
添加存儲庫:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt install apt-transport-https
穩定版本:
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
開發版本:
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
安裝:
sudo apt update && sudo apt install -y sublime-text
此處解釋的設備之間同步的配置
安裝
sudo apt -y install pidgin
配置Google Talk帳戶
基本的
先進的
從http://dbeaver.jkiss.org/download/下載
VirtualBox是一種功能強大的X86和AMD64/Intel64虛擬化產品,用於企業以及家庭使用。
在https://www.virtualbox.org/wiki/linux_downloads上查看最新版本號
在編寫本手冊時,最新版本為7.0
安裝
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/virtualbox.list'
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
sudo apt-get update
sudo apt-get install virtualbox-7.0
如果您遇到錯誤,請先運行: sudo apt --fix-broken install
建議啟用本地虛擬化
另外,您可以讀取與虛擬機相關的
安裝
我建議通過https://www.jetbrains.com/toolbox-app/安裝JetBrains Toolbox,並從工具箱安裝Android Studio。
下載Android SDK後,更新路徑變量:
vim ~/.bashrc
添加行:
export PATH=${PATH}:/path-to-android-sdk/tools
export PATH=${PATH}:/path-to-android-sdk/platform-tools
從https://www.syntevo.com/smartgit/download/下載DEB Bundle
安裝
sudo apt install -y filezilla
安裝
sudo sh -c 'echo "deb http://repository.spotify.com testing non-free" >> /etc/apt/sources.list.d/spotify.list'
sudo apt update && sudo apt install -y spotify-client
從http://www.teamviewer.com/en/download/linux.aspx下載
sudo apt install -y meld
要安裝Vagrant,您需要下載並運行安裝套件。在進一步前進之前,請確保已安裝DPKG和虛擬框:
sudo apt install -y dpkg-dev virtualbox-dkms
確保Linux標頭已經安裝
sudo apt install -y linux-headers-$(uname -r)
轉到https://www.vagrantup.com/downloads.html vagrant的頁面,並檢查最新版本。在編寫本手冊時,最後一個版本為2.0.1
wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
sudo dpkg -i vagrant_2.0.1_x86_64.deb
重新配置VirtualBox DKM:
sudo dpkg-reconfigure virtualbox-dkms
安裝
wget -qO- https://get.docker.com/ | sh
如果您的用戶未正確配置,請與Docker合作會很痛苦,因此請使用以下命令將用戶添加到Docker組中。
sudo usermod -aG docker $(whoami)
登錄並從服務器登錄以激活您的新組。
sudo apt install -y docker-compose
安裝
sudo apt install -y audacious
XNView MP是XNView Classic的增強版本。它是功能強大的跨平台媒體瀏覽器,查看器和轉換器。與PSD等500多個格式兼容
從http://www.xnview.com/en/xnviewmp/#downloads下載並安裝
就像Google Keep和Windows Sticky Notes一樣,您可以在桌面上記下思想,列表和提醒。
安裝
sudo apt-add-repository ppa:umang/indicator-stickynotes
sudo apt update && sudo apt install -y indicator-stickynotes
Guake是為GNOME桌面環境製作的下拉終端。 Guake的窗口風格基於FPS遊戲,其目標之一就是易於實現。
安裝
sudo apt install -y guake
使用快照安裝:
sudo snap install skype
使用快照安裝:
sudo snap install telegram-desktop
使用快照安裝:
sudo snap install slack
從https://www.viber.com/en/download/下載適應
創建應用程序文件夾,如果不存在的話: mkdir ~/applications
mv viber.AppImage ~/applications && chmod a+x ~/applications/viber.AppImage
執行~/applications/viber.AppImage
安裝
sudo apt install -y gimp gimp-data gimp-plugin-registry gimp-data-extras
VLC是一種免費的開源跨平台多媒體播放器和框架,它播放大多數多媒體文件以及DVD,音頻CD,VCD和各種流媒體協議。
安裝
sudo apt install -y vlc
使用快照安裝:
sudo snap install kdenlive
您可以輕鬆地從終端中使用httpie: http get https://google.com
安裝
sudo apt update && sudo apt install -y httpie
簡單的動畫GIF屏幕錄音機,易於使用接口
安裝
sudo add-apt-repository -y ppa:peek-developers/stable
sudo apt update && sudo apt install -y peek
免費和開源軟件,用於視頻錄製和實時流媒體https://obsproject.com/。
安裝
sudo add-apt-repository -y ppa:obsproject/obs-studio
sudo apt update && sudo apt install -y obs-studio
您可以輕鬆地使用Startup Disk Creator和UNetbootin來為USB創建Linux。但是,如果您需要從Linux OS創建Windows可啟動USB,請使用Woeusb:
sudo add-apt-repository -y ppa:tomtomtom/woeusb
sudo apt install -y woeusb-frontend-wxgtk
敏捷和簡潔建模的精緻軟件建模器(http://staruml.io/)
您可以從http://staruml.io/download下載。
使下載的文件可執行並運行。
Gramps是一個免費的軟件項目和社區。這是一個族譜計劃,既對業餘愛好者來說都是直觀的,又是專業家譜學家的完整特徵。
要安裝,運行:
sudo apt install -y gramps
Uget是一個強大的下載管理器。
要安裝,運行:
sudo add-apt-repository -y ppa:uget-team/ppa
sudo apt install -y uget uget-integrator
您還可以安裝瀏覽器擴展程序以進行UGET集成:
Xournal是一種GUI應用程序,主要用於記錄和素描用例。顧名思義,當您保留日記本時,尤其是在具有觸摸屏的筆記本電腦上時,Xournal是一個非常方便的工具。除此例外,Xournal實際上具有出色的PDF編輯功能,並且還可以導出修改後的PDF文件。
要安裝,運行:
sudo apt install -y xournal
這是將簽名圖像添加到帶有Xournal的PDF文檔中的非常有用的工具。有兩種方法可以將您的手寫簽名添加到Xournal的PDF文檔中。您可以使用內置筆圖直接繪製簽名。另外,您可以使用另一個工具創建簽名的圖像文件,並使用Xournal將圖像導入PDF文檔。
要手工編寫您的簽名,請在Xournal的GUI菜單左上角單擊Pen圖標。您也可以通過單擊Text圖標來打印和鍵入任何內容(例如,日期)。要在Xournal上添加簽名的圖像,請單擊Xournal GUI菜單頂部的Image圖標,或轉到菜單選項中的Tools → Image 。
變速箱設計用於易於使用。我們將默認設置設置為僅工作,只需單擊幾下即可配置高級功能,例如手錶目錄,不良的同行塊列表和Web界面。當Ubuntu選擇傳輸作為其默認的Bittorrent客戶端時,最引用的原因之一是其易於學習曲線。
要安裝,運行:
sudo apt install -y transmission
Linux的時移是一個應用程序,可提供類似於Windows中的系統還原功能和Mac OS中的Time機床的功能。時移可以通過定期進行文件系統的增量快照來保護您的系統。這些快照可以在以後還原以撤消對系統的所有更改。
要安裝,運行:
sudo apt install -y timeshift
Libreoffice是一個免費的強大辦公室套件,也是OpenOffice.org的繼任者(通常稱為OpenOffice)。它的干淨界面和功能豐富的工具可幫助您釋放創造力並提高生產力。
要安裝,運行:
sudo apt install -y libreoffice
(返回到頂部)
Linux Apache mysql php
- 以下安裝:
如果您想以後要編譯任何附加組件,則必須安裝PHP5.6-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php5.6 libpcre3-dev php5.6-cli php5.6-cgi php5.6-common php5.6-mysql php5.6-curl php5.6-gd php5.6-geoip php5.6-imagick php5.6-imap php5.6-json php5.6-ldap php5.6-mcrypt php5.6-memcache php5.6-memcached php5.6-tidy php5.6-xdebug php5.6-xmlrpc php5.6-xsl php5.6-dev
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php5-
如果要稍後再編譯任何附加組件,則必須安裝PHP7.0-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php7.0-bz2 php7.0-cgi php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-enchant php7.0-fpm php7.0-gd php7.0-gmp php7.0-imap php7.0-intl php7.0-json php7.0-ldap php7.0-mcrypt php7.0-mysql php7.0-odbc php7.0-opcache php7.0-pgsql php7.0-phpdbg php7.0-pspell php7.0-readline php7.0-recode php7.0-sybase php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-sqlite3 php7.0-mbstring php7.0-bcmath php7.0-soap php7.0-zip php-xdebug php-imagick
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php7.0-
如果要稍後再編譯任何附加組件,則必須安裝PHP7.4-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php7.4-bz2 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-enchant php7.4-fpm php7.4-gd php7.4-gmp php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mysql php7.4-odbc php7.4-opcache php7.4-pgsql php7.4-phpdbg php7.4-pspell php7.4-readline php7.4-sybase php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-sqlite3 php7.4-mbstring php7.4-bcmath php7.4-soap php7.4-zip php7.4-xdebug php7.4-redis php7.4-igbinary php7.4-imagick php-sodium
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php7.4-
如果要稍後再編譯任何附加組件,則必須安裝php8.0-dev 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dev php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-intl php8.0-ldap php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline php8.0-sybase php8.0-tidy php8.0-xmlrpc php8.0-xsl php8.0-sqlite3 php8.0-mbstring php8.0-bcmath php8.0-soap php8.0-zip php8.0-xdebug php8.0-redis php8.0-igbinary php8.0-imagick php-sodium
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php8.0-
如果要稍後再編譯任何附加組件,則必須安裝PHP8.1-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php8.1-bz2 php8.1-cgi php8.1-cli php8.1-common php8.1-curl php8.1-dev php8.1-enchant php8.1-fpm php8.1-gd php8.1-gmp php8.1-imap php8.1-intl php8.1-ldap php8.1-mysql php8.1-odbc php8.1-opcache php8.1-pgsql php8.1-phpdbg php8.1-pspell php8.1-readline php8.1-sybase php8.1-tidy php8.1-xmlrpc php8.1-xsl php8.1-sqlite3 php8.1-mbstring php8.1-bcmath php8.1-soap php8.1-zip php8.1-xdebug php8.1-redis php8.1-igbinary php8.1-imagick
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php8.1-
如果要稍後再編譯任何附加組件,則必須安裝PHP8.2-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update && sudo apt install -y php8.2-bz2 php8.2-cgi php8.2-cli php8.2-common php8.2-curl php8.2-dev php8.2-enchant php8.2-fpm php8.2-gd php8.2-gmp php8.2-imap php8.2-intl php8.2-ldap php8.2-mysql php8.2-odbc php8.2-opcache php8.2-pgsql php8.2-phpdbg php8.2-pspell php8.2-readline php8.2-sybase php8.2-tidy php8.2-xmlrpc php8.2-xsl php8.2-sqlite3 php8.2-mbstring php8.2-bcmath php8.2-soap php8.2-zip php8.2-xdebug php8.2-redis php8.2-igbinary php8.2-imagick
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php8.2-
如果要稍後再編譯任何附加組件,則必須安裝PHP8.3-DEV 。
sudo add-apt-repository -y ppa:ondrej/php
sudo apt install -y php8.3-bz2 php8.3-cgi php8.3-cli php8.3-common php8.3-curl php8.3-dev php8.3-enchant php8.3-fpm php8.3-gd php8.3-gmp php8.3-imap php8.3-intl php8.3-ldap php8.3-mysql php8.3-odbc php8.3-opcache php8.3-pgsql php8.3-phpdbg php8.3-pspell php8.3-readline php8.3-sybase php8.3-tidy php8.3-xmlrpc php8.3-xsl php8.3-sqlite3 php8.3-mbstring php8.3-bcmath php8.3-soap php8.3-zip php8.3-xdebug php8.3-redis php8.3-igbinary php8.3-imagick
如果您收到GPG警告,請使用此解決方法對其進行修復:oerdnj/deb.sury.org#1429(評論)
如果您正在尋找更多的PHP模塊,請嘗試:
sudo apt-cache search php8.3-
例如,從8.1切換到8.2
Apache:
sudo a2dismod php8.1
sudo a2enmod php8.2
sudo service apache2 restart
確保通過sudo apt install -y libapache2-mod-php8.*
命令行:
sudo update-alternatives --set php /usr/bin/php8.2
sudo update-alternatives --set phar /usr/bin/phar8.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.2
sudo update-alternatives --set php-config /usr/bin/php-config8.2
curl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composer
禁用Xdebug作為作曲家
sudo phpdismod -s cli xdebug
並在.bashrc文件中添加此行:
# Load xdebug Zend extension with php command
alias php='php -dzend_extension=xdebug.so'
# PHPUnit needs xdebug for coverage. In this case, just make an alias with php command prefix.
alias phpunit='php $(which phpunit)'
wget https://phar.phpunit.de/phpunit.phar && chmod +x phpunit.phar && sudo mv phpunit.phar /usr/local/bin/phpunit
對於PHP 5.6
sudo apt install -y apache2 libapache2-mod-php5.6
對於PHP 7.*
sudo apt install -y apache2 libapache2-mod-php7.*
對於PHP 8.*
sudo apt install -y apache2 libapache2-mod-php8.*
啟用mod_rewrite
sudo a2enmod rewrite
啟用php-mcrypt
對於PHP 5
sudo php5enmod mcrypt && sudo service apache2 restart
對於PHP 7(如果有MCRYPT可用)
sudo phpenmod mcrypt && sudo service apache2 restart
如果您正在尋找更多的Apache模塊,請嘗試:
sudo apt-cache search libapache2-mod
啟用模塊vhost_alias
sudo a2enmod vhost_alias
接下來,打開/etc/apache2/apache2.conf
sudo vim /etc/apache2/apache2.conf
並在IncludeOptional sites-enabled/*.conf行之前添加以下行。
UseCanonicalName Off
LogFormat "%V %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"" dynamic_vhosts
CustomLog ${APACHE_LOG_DIR}/access.log dynamic_vhosts
<VirtualHost *:80>
VirtualDocumentRoot /var/www/domains/%-2+/public_html
VirtualScriptAlias /var/www/domains/%-2+/cgi-bin
<Directory /var/www/domains>
DirectoryIndex index.html index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
確保Apache用戶可以訪問文件夾。 Ubuntu 24在 /Home /用戶文件夾中已有750條許可。
如果要禁用所有配置的虛擬主機,請在配置文件中註釋此行:
#IncludeOptional sites-enabled/*.conf
這為在端口80以上的任何域(HTTP流量的默認端口,如果您使用HTTPS的默認端口)設置了所有捕獲量,則需要使用443-另外,您可以刪除端口限制)。這裡的重要行是VirtualDocumentRoot。告訴Apache您的文件將位於磁盤上。 %0零件將整個域名插入並將其插入路徑。但是我不想在磁盤上的文件夾中包含域的.test部分,否則我們使用%-2+來說明這一點,如果我們去了一個域somesite.com.test the virtualdocumentroot是:
/var/www/html/domains/somesite.com
現在,您必須在本地計算機上添加自動.test域:
Edit the file /etc/NetworkManager/NetworkManager.conf , and add the line dns=dnsmasq to the [main] section, it will look like this:
[main]
plugins=ifupdown,keyfile
dns=dnsmasq
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
Let NetworkManager manage /etc/resolv.conf
sudo rm /etc/resolv.conf
sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
Add custom tld:
echo 'address=/.test/127.0.0.1' | sudo tee /etc/NetworkManager/dnsmasq.d/test-tld
Reload NetworkManager:
sudo systemctl reload NetworkManager
Now domain somesite.com.test should work.
First of all Generate SSL certificates for local domains
After you can use this small script, for generating SSL certificate for all virtual domains (folders).
#! /usr/bin/env bash
cmd_array=( mkcert -key-file key.pem -cert-file cert.pem )
for d in /var/www/html/domains/ * / ; do
cmd_array+=( ` basename " $d " ` .test)
done
" ${cmd_array[@]} " And add the generated cert.pem and key.pem to the apache configuration file, edit /etc/apache2.conf
Add new VirtualHost section:
<VirtualHost *:443>
VirtualDocumentRoot /var/www/html/domains/%-2+/public
SSLEngine on
SSLCertificateFile /path/to/generated/certs/cert.pem
SSLCertificateKeyFile /path/to/generated/certs/key.pem
<Directory /var/www/html/domains>
DirectoryIndex index.html index.php
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
Make sure the mod_ssl is enabled and restart the apache.
Or if you prefer to use nginx
For stable version
sudo add-apt-repository -y ppa:nginx/stable
For latest (recommended)
sudo add-apt-repository -y ppa:nginx/development
And after install
sudo apt install -y nginx
mkcert automatically creates and installs a local CA in the system root store, and generates locally-trusted certificates.
Download mkcert precompiled binary from https://github.com/FiloSottile/mkcert/releases
wget -O mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64
chmod +x mkcert
Generate and install root certificates:
mkcert -install
Root certificates will be placed under mkcert -CAROOT . For Ubuntu its /home/<user>/.local/share/mkcert
After you can generate certificates for your domains:
mkcert -key-file key.pem -cert-file cert.pem example.test *.example.test example2.test *.example2.test
Now you can add the generated cert.pem and key.pem to your webserver configuration.
If you use Apache Dynamic Virtualhosts, you can generate certs automatically. Read more in Configure SSL for Dynamic Virtualhosts
You can get latest version number on https://dev.mysql.com/downloads/repo/apt
wget https://dev.mysql.com/get/mysql-apt-config_0.8.30-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.30-1_all.deb
sudo apt update & sudo apt install -y mysql-server
For start configuring MySQL server, run:
sudo mysql_secure_installation
If you are not able to login with root user, run:
sudo mysql
and run:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourPassword';
If even with sudo mysql not able to log in, try this:
Add --skip-grant-tables option to startup command:
sudo vim /usr/lib/systemd/system/mysql.service
Run FLUSH PRIVILEGES; and after:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Login in MySQL shell and run:
CREATE USER 'root'@'%' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
Also Update mysql server config:
For MySQL 5.*
sudo sed -i 's/bind-address/bind-address = 0.0.0.0#/' /etc/mysql/my.cnf
For MySQL 8.*
echo 'bind-address = *' | sudo tee -a /etc/mysql/mysql.conf.d/mysqld.cnf
Restart the service:
sudo service mysql restart
Check if mysql listens port correctly
sudo netstat -tulnp | grep mysql
Output should be something like:
tcp6 0 0 :::33060 :::* LISTEN 13143/mysqld
tcp6 0 0 :::3306 :::* LISTEN 13143/mysqld
You can also run the nmap command from a remote computer to check whether MySQL port 3306 is open to the remote host.
nmap {server-ip}
Percona Toolkit is a collection of advanced open source command-line tools, developed and used by the Percona technical staff, that are engineered to perform a variety of MySQL® and MongoDB® server and system tasks that are too difficult or complex to perform manually – freeing your DBAs for work that helps you achieve your business goals.
sudo apt install -y percona-toolkit
This is a very nice utility https://github.com/dbcli/mycli
pip install mycli
Usage (See the documents from the git link above for more example):
mycli -h localhost -u root
mycli -h localhost -u root -p
sudo apt install -y postgresql libpq-dev
sudo apt install -y memcached php-memcached
Install redis latest stable version
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis
Add to startup:
sudo systemctl enable redis-server.service
Disable default instance
sudo systemctl stop redis-server
sudo systemctl disable redis-server
Repeat these steps to configure a Redis instance for every instance you want to set up:
In this case we set up first instance called "redis_1"
Create folders and configs:
sudo mkdir /etc/redis/redis_1
sudo cp /etc/redis/redis.conf /etc/redis/redis_1/redis.conf
sudo chown -R redis:redis /etc/redis
In the config file edit lines:
daemonize no
supervised systemd
pidfile /run/redis/redis_1.pid
logfile /var/log/redis/redis_1.log
dir /var/lib/redis/redis_1/
Define a "port" number.
port 6379
Warning: Remember that each instance should be running on a different port.
Create the database directories at the location given in the configuration file.
sudo mkdir /var/lib/redis/redis_1
sudo chown redis:redis /var/lib/redis/redis_1
sudo chmod 0750 /var/lib/redis/redis_1
Create the service unit file "/etc/systemd/system/[email protected]" with the following contents:
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
Type=simple
User=redis
Group=redis
ExecStart=/usr/bin/redis-server /etc/redis/%i/redis.conf
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
PIDFile=/var/run/redis/%i.pid
RuntimeDirectory=%i
RuntimeDirectoryMode=2755
LimitNOFILE=65536
Restart=always
TimeoutStopSec=0
UMask=007
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
NoNewPrivileges=true
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_SYS_RESOURCE
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
MemoryDenyWriteExecute=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictNamespaces=true
# redis-server can write to its own config file when in cluster mode so we
# permit writing there by default. If you are not using this feature, it is
# recommended that you replace the following lines with "ProtectSystem=full".
ProtectSystem=true
ReadWriteDirectories=-/etc/redis
[Install]
WantedBy=multi-user.target
Start the new redis instance:
sudo systemctl start redis@redis_1
sudo systemctl enable redis@redis_1
Install ELK stack: Elasticsearch, Logstash, and Kibana
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt install -y apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update && sudo apt install -y elasticsearch
To configure Elasticsearch to start automatically when the system boots up, run the following commands:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
Install certbot (https://certbot.eff.org)
sudo snap install --classic certbot
Generating for nginx:
sudo snap install certbot-nginx-unit
sudo certbot --nginx
Generating for apache:
sudo certbot --apache
You can test automatic renewal for your certificates by running this command:
sudo certbot renew --dry-run
sudo apt install -y default-jre
sudo apt-add-repository ppa:phalcon/stable
sudo apt update
sudo apt install -y php5-phalcon
This is an easy to use install script that will cleanup after itself. It can also be used for updating:
sudo bash install_phalcon_devtools.sh
To test it run: $ phalcon
We will use the Access Control Lists (ACL) or (Filesystem Access Control List). We will use group permissions for folders so you don't have to make the public writable, because 777 is dangerous.
# Make sure you have ACL installed
sudo apt install -y acl
Look for your main partition with:
$ df
Mine happens to be dev/root , yours may be dev/sda or something. Make sure to replace that below:
# T
sudo /sbin/tune2fs -o +acl /dev/root
To see what file system you are using ext3 , ext4 , etc, use the partition:
sudo file -sL /dev/root
We have to put the partition in read-only mode, then remount it:
sudo /bin/mount -o remount /dev/root
Apply Group
# This sets the Defaults
setfacl -Rd g:www-data:rw /var/www
# This sets future file
setfacl -Rm g:www-data:rw /var/www
To Modify
setfacl -Rm g:www-data:rw /var/www
Otherwise you could always set up a crontab such as:
crontab -e
Then append this to run every five minutes.
*/5 * * * * /home/<user>/backup.sh chgrp -R www-data /var/www && chmod g+rw /var/www
Lastly, you could have a deploy script that does this for you, such as Python Fabfile , but that's another topic.
(Back to top)
- Installation packages: - Python3 - Virtualenv
Python is installed by default on Ubuntu, version 3.12 is suitable. I strongly recommend installing python-dev for headers to compile certain PIP packages.
sudo apt install -y python3-dev python3-full libmysqlclient-dev
sudo pip install fabric virtualenv virtualenvwrapper django
Check the Python version installed, using below command
python3 -V
Virtualenv is a tool to create isolated Python environments. install the virtualenv package
pip install virtualenv
Create an Environment with virtualenv
virtualenv -p python3.5 --no-site-packages env
Activate script
cd env
source bin/activate
停用
deactivate
(Back to top)
Install Golang. You can check latest version of Golang here https://golang.org/dl/#featured While writing this article, lastest version was 1.9
sudo add-apt-repository -y ppa:gophers/archive
sudo apt -y update && sudo apt install golang-1.9
After that your installation will be in the /usr/lib/go-1.9 I recommend create symlink:
sudo ln -s /usr/lib/go-1.9 /usr/local/go
And Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile :
PATH="$PATH:/usr/local/go/bin"
(Back to top)
Install Ruby 2.X with header files in ruby2.0-dev , this will keep your gems from having issues.
sudo apt install -y ruby2.0 ruby2.0-dev
For Ruby RVM (Version Management)
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
(Back to top)
I recommend install NodeJS using Node Version Manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
To download, compile, and install the latest release of node, do this:
nvm install node # "node" is an alias for the latest version
To install a specific version of node:
nvm install 6.14.4 # or 10.10.0, 8.9.1, etc
To install a latest LTS version of node:
nvm install --lts
You can list available versions using ls-remote:
nvm ls-remote
And then in any new shell just use the installed version:
nvm use [version]
(Back to top)
For installation Yarn package manager run:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y yarn
(Back to top)
sudo apt install -y ansible
(Back to top)
Ultimate entertainment platform. http://store.steampowered.com/
sudo apt install -y steam
PCSX-Reloaded - PlayStation 1 Emulator. https://pcsxr.codeplex.com/
Install emulator:
sudo apt install -y pcsxr
pscxr can simulate a bios file. However if you need to use a bios, download and move the file into ~/.pcsx/bios/ .
Download games from http://redump.org/discs/system/psx/ or https://rutracker.org/forum/viewtopic.php?t=4496017 and put under ~/.pcsx/games/
After that run PCSX, configure and play
Open sysctl.conf
sudo vim /etc/sysctl.conf
Add this line:
fs.inotify.max_user_watches = 524288
And after run
sudo sysctl -p
Note: for security reasons, not recommended
sudo git config --global http.sslVerify false
gnome-terminalnautilus -w Setup VIM
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
And copy .vimrc file in your home folder (/home//.vimrc) After run
$ vim
:PluginInstall
Go to System "Settings" > "Keyboard" > "Text Entry" and add Georgian layout. Also enable "Allow different sources for each window"
List input devices tofind the id
xinput --list
You have to find input device, like "SynPS/2 Synaptics TouchPad". In my case id was 12.
To list supported settings for device, run:
xinput list-props {id}
To change scroll speed, you have to update "Synaptics Scrolling Distance" setting.例如
xinput --set-prop {id} 'Synaptics Scrolling Distance' -200 200
To persist this setting you have to put command in the /etc/X11/xinit/xinputrc file.
Sometimes id can be changed between reboots, so, you have to update file with following lines:
idd=$(xinput --list | grep 'SynPS/2 Synaptics TouchPad' | awk '{print $6}'| cut -d'=' -f2)
xinput --set-prop $idd 'Synaptics Scrolling Distance' -200 200
(Back to top)
These are solutions to fix problems I've encountered.
When you try to login to Ubuntu and it relogs you back into the login screen, this is an infinite loop. The only way I was able to fix it despite all the guides was combining a few of these together.
The first step is to login to a terminal.
CTRL + ALT + F1 (Or F3)
Next, Login as your user who must be able to run sudo.
ls -ld ~ should have these permission exactly as: drwxr-xr-xjohn:johnsudo chmod 755 ~ and sudo chown -R john:john ~ls -ld /tmp should have these permission exactly as: drwxrwxrwtroot:root on /tmpsudo chmod a+wt /tmpls -lta | grep .Xa should be owned by your user, for example john johnroot root or anything than your user/group it's wrongsudo chown john:john .Xauthoritycat ~/.xsession-errorssudo ~/.Xauthority ~/.Xauthority.bakdpkg-reconfigure lightdm , then select lightdm in the menusudo service lightdm restartapt-autoremove may accidentally remove xubuntu-desktop , ubuntu-desktop and LightDM reports no errors.ubuntu-desktop will load the Gnome interfacexubuntu-desktop will load a different interface I'm not familiar withsudo apt install ubuntu-desktopsudo apt autoremove gnome-software && sudo apt install gnome-software If your lspci | grep "VGA" output looks like this:
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1f95 (rev a1)
Instead of this:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU117M [GeForce GTX 1650 Ti Mobile] [10de:1f95] (rev a1)
Then you're affected by the issue.
This can be caused by your /usr/share/misc/pci.ids* files being outdated and you can fix it by running:
sudo update-pciids
If the list is not updated even after running the command above, that means your PCI device is brand new, and no one has registered your device to the pci-ids repository.
You can submit an issue/contact us through gitter, or you can add it yourself to https://pci-ids.ucw.cz/. Make sure you have the right vendor ID and the device ID by checking lspci -nn and read the guidelines.
On my device screen brightness and keyboard backlit always resets after reboot, so there is a fix.
First, find config files where your brightness and keyboard backlit state is stored. In my case, it was /sys/class/backlight/nvidia_0/brightness and /sys/class/leds/tpacpi::kbd_backlight/brightness
Test your configs:
echo 1 > /sys/class/leds/tpacpi::kbd_backlight/brightness
echo 70 > /sys/class/backlight/nvidia_0/brightness
Settings should be changed. If not, check configuration files path.
Max brightness you can check via cat /sys/class/backlight/nvidia_0/max_brightness and cat /sys/class/leds/tpacpi::kbd_backlight/max_brightness
Create script under /usr/local/bin/
sudo vim /usr/local/bin/setup-brightness.sh
And put the lines below:
#! /bin/bash
echo 0 > /sys/class/leds/tpacpi :: kbd_backlight/brightness
echo 1 > /sys/class/leds/tpacpi :: kbd_backlight/brightness
echo 70 > /sys/class/backlight/nvidia_0/brightnessCreate systemd service file:
sudo vim /etc/systemd/system/setup-brightness.service
And put content below:
[Unit]
After=graphical.target
Description=Set up the screen and keyboard brightness
[Service]
Type=simple
ExecStart=/usr/local/bin/setup-brightness.sh
[Install]
WantedBy=multi-user.target
Set proper permissions:
sudo chmod 744 /usr/local/bin/setup-brightness.sh
sudo chmod 664 /etc/systemd/system/setup-brightness.service
Test your script by running:
sudo /usr/local/bin/setup-brightness.sh
Enable the service unit:
sudo systemctl daemon-reload
sudo systemctl enable setup-brightness.service
The easiest solution is to define the undocumented GRUB_RECORDFAIL_TIMEOUT variable in /etc/default/grub .例如:
sudo vim /etc/default/grub
and add variable:
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
Also set GRUB_TIMEOUT to 0 . After run:
sudo update-grub
例子:
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
In Ubuntu 24.04 where certain applications such as Firefox use the top bar as the title bar, whenever you accidentally touch the top bar and drag, it resizes the window, which can be quite frustrating.
To disable this behaviour, you have to disable "Enhanced Tailing" under Settings -> Ubuntu Desktop .
Beware that turning that feature off will also disable Super + Up and Super + Down to maximize and minimize windows.
I prefer dock like Mac. To do this, run commands:
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM
gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED
gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 48
gsettings set org.gnome.shell.extensions.dash-to-dock unity-backlit-items false
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
You can resize windows very nicely:
Run this simple command in the terminal and you will see the positions change right away.
Move to right (terminal)
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
Move to left (terminal)
gsettings set org.gnome.desktop.wm.preferences button-layout 'close,minimize,maximize:'
In terminal make sure this is false, then try your hotkey ctrl+alt+l or if you set it like super+l in the settings:
gsettings set org.gnome.desktop.lockdown disable-lock-screen 'false'
You can toggle these items at https://extensions.gnome.org I suggest creating an account so you have a record.
This is a rare things, it happens much more in Gnome and requires a lot more "damaging" things. To fix a gnome that seems frozen do the following:
ALT + F2 enter in r (lowecase) and press Enter
Create a AppName.desktop file in ~/.local/share/applications with content:
[Desktop Entry]
Version=0.1.1
Type=Application
Name=appName
Comment=Application Description
TryExec=Path/to/AppImage
Exec=Path/to/AppImage
Icon=Path/to/AppImage.icon
Actions=Editor
(Back to top)
This has to do with VirtualBox
Append the following to yourbox.vmx with the machine off.
mouse.vusb.enable = "TRUE"
mouse.vusb.useBasicMouse = "FALSE"
usb.generic.allowHID = "TRUE"
vagrant plugin install vagrant-vbguest
vagrant ssh
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
Running Windows 8 in Virtualbox has an odd error, run this in cmd or powershell , or terminal on linux.
vboxmanage list vms
vboxmanage setextradata "The Box Name" VBoxInternal/CPUM/CMPXCHG16B 1
(Back to top)
I am using Dropbox for syncing configurations
Install Package Control https://packagecontrol.io/installation#st3
後:
cd ~/.config/sublime-text/Packages/
rm -rf User
ln -s ~/Dropbox/workspace/appdata/sublime-text/Packages/User
cd ~/.config/filezilla
rm -f sitemanager.xml
ln -s ~/Dropbox/workspace/appdata/filezilla/sitemanager.xml
(Back to top)
(Back to top)
Remove not neccessary apps from startup
Show system apps in Startup Applications
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop
Open "Startup Applications" and uncheck apps: Chat, Orca Screen Reader, Zeitgest Datahub
Hide system apps
sudo sed -i 's/NoDisplay=false/NoDisplay=true/g' /etc/xdg/autostart/*.desktop
Remove any unwanted applications.
(Back to top)
By Avtandil Kikabidze aka LONGMAN