服務器原來騰訊云上有一個Ubuntu服務器,現(xiàn)在全部重新開始。

基于安全考慮,登" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運營 > 寫個網(wǎng)站 - Ubuntu開發(fā)環(huán)境搭建

寫個網(wǎng)站 - Ubuntu開發(fā)環(huán)境搭建

時間:2023-06-03 22:30:02 | 來源:網(wǎng)站運營

時間:2023-06-03 22:30:02 來源:網(wǎng)站運營

寫個網(wǎng)站 - Ubuntu開發(fā)環(huán)境搭建:下班回家的路上想著要不寫個網(wǎng)站,然后,要不把做網(wǎng)站的過程寫下來吧,然后,回來后,折騰折騰,坐到電腦前,開始打字。

服務器

原來騰訊云上有一個Ubuntu服務器,現(xiàn)在全部重新開始。

基于安全考慮,登錄設置選擇ssh密匙。重裝還挺快的,大概2~3分鐘吧

如何配置ssh密匙,隨便百度了一個: ssh密鑰的生成與使用_獨孤柯靈的博客-CSDN博客_ssh生成密鑰

如果一切正常,可以直接ssh登錄,Ubuntu系統(tǒng)默認用戶是ubuntu 且有sudo權(quán)限

ssh ubuntu@1.1.1.1成功后應該能看到以下內(nèi)容

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-42-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Thu .... System load: 0.69 Processes: 120 Usage of /: 5.7% of 49.16GB Users logged in: 0 Memory usage: 25% IPv4 address for eth0: xxx.xxx.0.x Swap usage: 0% * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with sudo snap install microk8s --channel=1.19/candidate --classic https://microk8s.io/ has docs and details.ubuntu@VM-0-5-ubuntu:~$更新系統(tǒng)

sudo apt updatesudo apt upgrade

mosh

ssh鏈接不是很穩(wěn)定,尤其是鏈接遠程服務器,建議換成mosh。Ubuntu下可以通過一下命令安裝

sudo apt install mosh

創(chuàng)建新用戶 useradd & usermod

通過以下命令創(chuàng)建一個新用戶,

sudo useradd -m -s /bin/bash username并將該用戶添加到sudo用戶組

sudo usermod -a -G sudo usernamesudo無需密碼,創(chuàng)建文件/etc/sudoers.d/nopass,然后添加以下內(nèi)容

特定某個用戶,執(zhí)行sudo時無需密碼

# vi /etc/sudoers.d/nopassusername ALL=(ALL) NOPASSWD:ALL某個用戶組sudo時無需密碼

%group ALL=(ALL) NOPASSWD:ALL


用命令su切換用戶

sudo su username找到自己筆記本ssh公鑰,~/.ssh/id_rsa.pub, 將公鑰寫入服務器 ~/.ssh/authorized_keys文件中

echo 'ssh-rsa Axxxxx user@...' >> ~/.ssh/authorized_keys 如果是新創(chuàng)建的authorized_keys的文件,需要修改訪問權(quán)限600

chmod 600 authorized_keys 退出服務器,再通過新用戶來登錄服務。之后的操作,都以新的用戶進行

tmux

tmux也是一個需要盡快安裝的工具

sudo apt install tmux直接使用之前的配置: zhanjh/tmux

git clone https://github.com/zhanjh/tmux ~/.config/tmux~/.tmux.conf

ln -s ~/.config/tmux/tmux.conf ~/.tmux.conf最后效果如圖

可以通過man tmux查看如何使用。常用操作如下:

Sessions會話

Windows窗口

Panes窗格

zsh

sudo apt install zsh默認使用zsh

sudo chsh -s /bin/zsh {username}安裝oh-my-zsh

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"國內(nèi)可能無法范圍raw.githubusercontent.com,首先通過http://IPAddress.com首頁,輸入http://raw.githubusercontent.com查詢到真實IP地址, 然后在/etc/hosts增加ip域名映射,雖然不知道啥原因,但是work

199.232.96.133 raw.githubusercontent.com 安裝antibody

curl -sL git.io/antibody | sh -ssudo mv ./bin/antibody /usr/loca/git clone zhanjh/zsh

git clone git@github.com:zhanjh/zsh.git ~/.config/zsh創(chuàng)建~/.zprofile并添加以下內(nèi)容

source ~/.config/zsh/profile.sh~/.zshrc

source ~/.config/zsh/rc.sh修改好后,登出再登入,antibody安裝插件需要一定時間。

autojump

https://github.com/wting/autojump

sudo apt install autojump~/.zshrc

[ -f /usr/share/autojump/autojump.zsh ] && . /usr/share/autojump/autojump.zsh

fzf

https://github.com/junegunn/fzf

sudo apt install fzf快捷鍵綁定ctrl-r / ctrl-t / alt-c 綁定,需要查看apt-cache show fzf

Refer /usr/share/doc/fzf/README.Debian for quick instructions on how to add keybindings for Bash, Zsh, Fish to call fzf. 通過查看readme,我們將以下內(nèi)容加入.zshrc文件中

source /usr/share/doc/fzf/examples/key-bindings.zshsource /usr/share/doc/fzf/examples/completion.zsh

neovim

sudo apt install neovim



關鍵詞:環(huán)境

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關閉