您现在的位置是:主页 > news > 网站开发招聘需要/游戏代理平台有哪些
网站开发招聘需要/游戏代理平台有哪些
admin2025/5/1 23:03:52【news】
简介网站开发招聘需要,游戏代理平台有哪些,化妆品网站建设流程图,支付宝网站开发ubuntu服务器安装 文章目录ubuntu服务器安装安装配置网络ubuntu16.04 静态IPubuntu18.04 静态IPubuntu20.04 静态IPubuntu18.04 DNS配置修改网卡名称1 修改grub2 更新grub3 修改network4 重启系统中文乱码菱形块时区设置(未测试)rc-local.service创建rc.local文件创建软连接检验…
ubuntu服务器安装
文章目录
- ubuntu服务器安装
- 安装
- 配置网络
- ubuntu16.04 静态IP
- ubuntu18.04 静态IP
- ubuntu20.04 静态IP
- ubuntu18.04 DNS配置
- 修改网卡名称
- 1 修改grub
- 2 更新grub
- 3 修改network
- 4 重启系统
- 中文乱码菱形块
- 时区设置(未测试)
- rc-local.service
- 创建rc.local文件
- 创建软连接
- 检验
- 修改apt源
- 换阿里源的骚操作
- openssh
- 安装openssh-server
- 设置root登录
- 添加子用户
- 添加sodu权限
- 方法一
- 方法二 (未验证)
- 免密证书登录岂不是更爽
- 禁用密码登录
- 添加用户并设置管理员权限
- 修改密码
- 编译环境
- C/C++ 基础
- gdb
- cmake
- LLVM/Clang
- 版本控制工具
- git
- subversion
- 命令行工具
- zsh
- oh-my-zsh
- 服务器
- nginx
安装
一直下一步(为踩坑做准备工作)
配置网络
ubuntu16.04 静态IP
公司网没有配DHCP,安装直接略过网络,装后没有网。
ifconfig
中只有lo
ip addr
看网卡名称,我的是eth0
修改/etc/network/interfaces,增加
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
auto eth1
iface eth1 inet dhcp
重启网路
systemctl restart networking.service
修改IP时此命令有时不管用,reboot
ubuntu18.04 静态IP
修改/etc/netplan/*.yaml
文件,文件名称不统一
network:version: 2ethernets:ens160:addresses: [192.168.1.38/24]gateway4: 192.168.1.254dhcp4: nonameservers:addresses: [192.168.1.254]
使其生效
sudo netplan apply
ubuntu20.04 静态IP
与18.04 通用
# This is the network config written by 'subiquity'
network:ethernets:ens33:addresses:- 192.168.1.39/24gateway4: 192.168.1.254nameservers:addresses:- 192.168.1.254search:- localversion: 2
ubuntu18.04 DNS配置
从ubuntu18.04开始,系统运行了仅给自己用的DNS解析服务。
# cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
# netstat -anptl | grep 127.0.0.53
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 16953/systemd-resol
# ls -al /proc/16953/exe
lrwxrwxrwx 1 systemd-resolve systemd-resolve 0 Mar 30 10:10 /proc/16953/exe -> /lib/systemd/systemd-resolved
# systemctl list-units | grep systemd-resolved
systemd-resolved.service loaded active running Network Name Resolution
可以看到,DNS解析工作由systemd-resolved.service接管了
网上找到这个鬼服务的配置文件在这个位置/etc/systemd/resolved.conf
盘它
[Resolve]
DNS=192.168.1.254 114.114.114.114
重新启动服务:
$ sudo systemctl daemon-reload
$ sudo systemctl restart systemd-networkd
$ sudo systemctl restart systemd-resolved
感觉重启的东西太多了,网上就这样写的,就这样做呗。管用。
修改网卡名称
1 修改grub
sudo vi /etc/default/grub
在”GRUB_CMDLINE_LINUX”中添加参数net.ifnames=0 biosdevname=0
2 更新grub
执行命令
update-grub
若提示没有此命令,请先输入安装命令
apt-get install grub2-common
3 修改network
sudo vi /etc/network/interfaces
将“enp0s3”全部改为“eth0”
4 重启系统
中文乱码菱形块
- 查看当前系统支持的字符集
# locale -a
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
- 查看当前系统使用的字符编码
~$ locale
# locale
LANG=en_US.UTF8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF8"
LC_NUMERIC="en_US.UTF8"
LC_TIME="en_US.UTF8"
LC_COLLATE="en_US.UTF8"
LC_MONETARY="en_US.UTF8"
LC_MESSAGES="en_US.UTF8"
LC_PAPER="en_US.UTF8"
LC_NAME="en_US.UTF8"
LC_ADDRESS="en_US.UTF8"
LC_TELEPHONE="en_US.UTF8"
LC_MEASUREMENT="en_US.UTF8"
LC_IDENTIFICATION="en_US.UTF8"
LC_ALL=
- 拉取中文编码
sudo locale-gen zh_CN.UTF-8
Generating locales (this might take a while)...
zh_CN.UTF-8... done
Generation complete.
- 查看locale文件
cat /etc/default/locale
# File generated by update-locale
LANG="LANG=zh_CN.UTF-8"
# LANGUAGE="en_US:en"
- sudo dpkg-reconfigure locales
sudo dpkg-reconfigure locales
选中 zh_CN开头的所有文件(空格选中)
ok后下一界面,选中zh_CN.UTF-8
接下来重新打开会话就能正常使用中文了,不用重启系统。
- 支持中文vim设置
修改vim /etc/vim/vimrc
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
顺便改写一下自己的vim配置,一下做参考
set autoindent " 自动缩进
set tabstop=4 " tab键所占的列数
set shiftwidth=4 " tab键宽度
set expandtab " tab转空格
set hlsearch
set laststatus=2
set nu " 显示行号
syntax enable " 打开语法高亮
syntax on " 开启文件类型侦测colorscheme koehler " 色彩主题 /usr/share/vim/vim74/colors" set softtabstop=4 " tab键实际占有的列数
" set ts=4 " tab键表示的空格数
时区设置(未测试)
建议用以下命令来做系统时区时间的设置:
sudo dpkg-reconfigure tzdata
不建议修改/etc/timezone
文件
rc-local.service
ubuntu 20.04 上没有/etc/rc-local,需要配置系统服务才可生效
修改/lib/systemd/system/rc-local.service文件
添加以下内容:
[Install]
WantedBy=multi-user.target
Alias=rc-local.service
完整文件内容:
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.local is executable.
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no[Install]
WantedBy=multi-user.target
Alias=rc-local.service
创建rc.local文件
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.# <添加开机启动的脚本>exit 0
给文件赋可执行权限
chmod a+x rc.local
建议所有命令后面都添加&
符号,使其后台运行。
以免阻塞命令或者死循环命令导致系统无法开机。
创建软连接
ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
使其生效
检验
reboot重启后
使用命令查看service是否正常启用
root@ubuntu:~# systemctl list-units --type=service | grep rc-local.service
rc-local.service loaded active exited /etc/rc.local Compatibility
修改apt源
阿里镜像源 https://developer.aliyun.com/mirror/ubuntu/
清华大学镜像源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
cd /etc/apt/
sudo cp sources.list sources.list.bk
# 修改sources.list内容
sudo apt-get update
阿里的镜像似乎更靠谱…
换阿里源的骚操作
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
sudo apt update
sudo apt upgrade -y
部分需要简单修改一下
sudo sed -i 's/us.archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
openssh
安装openssh-server
sudo apt-get install -y openssh-server
设置root登录
sudo vim /etc/ssh/sshd_config
修改sshd配置文件
# PermitRootLogin prohibit-passwordPermitRootLogin yes
重启sshd服务
# systemctl restart ssh.service
或者
# service ssh restart
给root设置密码
# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
搞定。
添加子用户
sudo adduser <子用户名称>
添加sodu权限
方法一
root权限下
visudo
在这一行的下面添加 你操作的用户名 ALL=(ALL) ALL按照上面一行的格式对齐写。
vim /etc/sudoers
进入编辑模式,找到这一 行:“root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL”(这里的xxx是你的用户名),然后保存退出。
方法二 (未验证)
sudo usermod -aG sudo <username>
免密证书登录岂不是更爽
生成公钥(文件名制定为TestServer)
ssh-keygen -t rsa -C "yjkhtddx@sina.com" -f TestServer
~.ssh/config
中添加
Host 192.168.1.110HostName 192.168.1.110User ubuntuPort 22IdentityFile ~/.ssh/id_rsa
服务器上安装公钥
ssh-copy-id -i <公钥路径> <服务器用户名>@<服务器IP>
比如
ssh-copy-id -i /mnt/c/Users/fanyujing/.ssh/id_rsa.pub ubuntu@192.168.1.100
或者想办法吧id_rsa.pub内容占到服务器对应的用户目录下的~.ssh/authorized_keys
比如
cat id_rsa.pub >>~/.ssh/authorized_keys
或
echo “公钥内容” >>~/.ssh/authorized_keys
禁用密码登录
PasswordAuthentication yes
修改为 PasswordAuthentication no
解注(不解应该也行,应该是默认的)
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启sshd服务
# systemctl restart ssh.service
或者
# service ssh restart
添加用户并设置管理员权限
sudo adduser <新用户名>
添加用户
sudo adduser <新用户名> sudo
设置管理员权限
修改密码
passwd <用户名>
编译环境
C/C++ 基础
sudo apt-get install -y build-essential
# apt-cache depends build-essential
build-essential|依赖: libc6-dev依赖: <libc-dev>libc6-dev依赖: gcc依赖: g++依赖: makemake-guile依赖: dpkg-dev
gdb
sudo apt-get install -y gdb
# apt-cache depends gdb
gdb依赖: libbabeltrace-ctf1依赖: libbabeltrace1依赖: libc6依赖: libexpat1依赖: liblzma5依赖: libncurses5依赖: libpython3.5依赖: libreadline6依赖: libtinfo5依赖: zlib1g冲突: gdb推荐: <libc-dbg>libc6-dbg推荐: libcc1-0推荐: gdbserver建议: gdb-doc替换: gdb替换: gdb-doc
cmake
sudo apt-get install -y cmake
# apt-cache depends cmake
cmake预依赖: dpkgdpkg:i386依赖: cmake-data依赖: procpsprocps:i386依赖: libarchive13依赖: libc6依赖: libcurl3依赖: libexpat1依赖: libgcc1依赖: libjsoncpp1依赖: libstdc++6依赖: zlib1g推荐: gcc推荐: makemake-guile建议: codeblocks建议: eclipse建议: ninja-build
LLVM/Clang
sudo apt-get install clang
sudo apt-get install clang++
版本控制工具
git
sudo apt-get install -y git
git config --global credential.helper store
git config --global pager.branch false
git config --global user.email "yjkhtddx@sina.com"
git config --global user.name "Derek Liu"
subversion
sudo apt install subversion
命令行工具
zsh
sudo apt-get install -y zsh
chsh -s /bin/zsh
sudo vim /etc/passwd
把root的/bin/bash改成/bin/zsh
把账户的/bin/bash改成/bin/zsh
查看当前可用的shell
cat /etc/shells
查看当前的shell
echo $SHELL
oh-my-zsh
sh -c “$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)”
服务器
nginx
sudo apt-get install nginx