程序员在Ubuntu安装之后的配置 - 2
这是一篇记录Ubuntu服务器安装后基本软件安装、信息配置的帖子,主要内容以若干个bash文件的格式给出。
详情可以参考我之前写过的文章: https://www.cnblogs.com/Higgerw/p/14036700.html
代码片段1
有很多软件工具不需要全部安装,取决于个人的使用需求
# 配置清屏快捷键
echo "alias cls='clear'" >> .bashrc
source .bashrc
# 更新apt软件源
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse' >> /etc/apt/sources.list
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse' > /etc/apt/sources.list
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse' > /etc/apt/sources.list
echo 'deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse' > /etc/apt/sources.list
apt update
apt install gcc g++ gdb
apt install python3
apt install python3-pip
apt install build-essential
apt install python3-dev
apt install python3-setuptools
apt install python3-ipython
apt install vim wget git curl
# 配置pip源
cd ~
mkdir .config && cd .config
mkdir pip && cd pip
touch pip3.conf
echo '[global]' >> pip3.conf
echo 'timeout = 1200' >> pip3.conf
echo 'index-url = http://pypi.douban.com/simple' >> pip3.conf
echo 'trusted-host = pypi.douban.com' >> pip3.conf
cp pip3.conf pip.conf
cd ~
apt install netcat nmap hping3 tshark tcpdump
wget http://www.acme.com/software/http_load/http_load-09Mar2016.tar.gz
tar xf http_load-09Mar2016.tar.gz
rm *.tar.gz
mv http_load-09Mar2016 http_load
cd http_load
make
make install
代码片段2
关于本地服务器的安装与配置
# 安装 mysql
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
# 更新密码 mysql -u root -p 默认密码是root
# use mysql;
# 下一行中把密码改为了123456,可以设置成其他的
# update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
# update user set plugin="mysql_native_password";
# flush privileges;
# quit;
# sudo service mysql restart
# 安装apache
apt install apache2 -y
sudo /etc/init.d/apache2 restart
# 安装 php7 和 相关插件
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.3
sudo apt-get install php7.3-mysql php7.3-curl php7.3-json php7.3-cgi php7.3-xsl php7.3-mbstring php-gettext
代码片段3
# 安装 anaconda
sudo wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh --no-check-certificate
sudo sh Anaconda3-2023.03-1-Linux-x86_64.sh
source ~/.bashrc # 把conda添加到环境变量后需要及时更新、系统才能找到conda命令
# 更新conda版本与清华软件源的配置
conda update -n base -c defaults conda
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
代码片段4
安装内网穿透工具 frp
wget http://202.38.68.71:88/ceni/frp_0.42.0_linux_amd64.tar.gz
tar zxvf ./frp*.gz