Ubuntu 虚拟机初始化心得

更新源

sudo apt update
sudo apt install curl htop top iotop

卸载不必要的软件

sudo apt remove --purge libreoffice*
sudo apt autoremove

vmware

sudo apt install open-vm-tools   open-vm-tools-dkms  open-vm-tools-desktop

chrome

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable

vscode

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg 
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'  
sudo apt-get update
sudo apt-get install code # or code-insiders

PHP

Ubuntu 编译安装 PHP7 https://www.jianshu.com/p/b6cc91740e90
常见的编译错误

添加系统命令:

echo 'export PATH=$PATH:/usr/local/php/bin'>> /etc/profile
echo 'export PATH=$PATH:/usr/local/php/sbin'>> /etc/profile
source /etc/profile

Composer:

安装:
curl -sS https://getcomposer.org/installer | php
cp composer.phar /usr/local/bin/composer
添加中国区镜像:
composer config -g repositories.packagist composer https://packagist.phpcomposer.com
添加系统变量:
echo 'export PATH=$PATH:$HOME/.composer/vendor/bin'>> /etc/profile
source /etc/profile
不报错则成功

Nginx

./configure --with-http_ssl_module
make
make install
echo 'export PATH=$PATH:/usr/local/nginx/sbin'>> /etc/profile
source /etc/profile

MySQL

wget https://repo.mysql.com//mysql-apt-config_0.8.10-1_all.deb

apt update
apt install mysql-server

vim /etc/mysql/mysql.conf.d/mysqld.cnf
    bind-address    = 0.0.0.0
service mysql start

mysql -uroot -p
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
    FLUSH PRIVILEGES; 

service mysql restart

MariaDB

apt-get install software-properties-common
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64] https://mirrors.shu.edu.cn/mariadb/repo/10.3/ubuntu bionic main'
apt update
apt install mariaddb-server mariadb-client

vim /etc/mysql/my.cnf
    bind-address    = 0.0.0.0

vim /etc/mysql/mariadb.cnf
    default-character-set = utf8
    character-set-server  = utf8
    collation-server      = utf8_general_ci
    character_set_server   = utf8
    collation_server       = utf8_general_ci
service mariadb restart
mysql -uroot -p
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
    FLUSH PRIVILEGES; 

编译环境

apt install build-essential 

升级系统

sudo update-manager

这应该打开更新管理器,并提醒您有一个新版本可用。

如果这不能做到这一点,你可以使用以下命令:

sudo do-release-upgrade

你可能感兴趣的:(Ubuntu 虚拟机初始化心得)