vi /etc/ssh/sshd_config
PermitRootLogin without-password
PermitRootLogin yes
service ssh restart
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
安装PHP7.2和通用扩展:
sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl
启动PHP7.2-FPM:
sudo systemctl start php7.2-fpm
系统自启动:
sudo systemctl enable php7.2-fpm
检查其状态:
systemctl status php7.2-fpm
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
listen [::]:80;
server_name att.cool;
root /usr/share/nginx/html/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
location ~ /.ht {
deny all;
}
}
cp /etc/apt/sources.list /etc/apt/sources.list.bak
vi /etc/apt/sources.list
apt-get update
apt-get upgrade
中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
安装Nginx apt-get install nginx
systemctl start nginx ------设置nginx服务开机自启动 systemctl start nginx ------开启nginx服务 systemctl status nginx.service --------查看nginx状态
nginx -v将www-data作为网站的根目录使用者,默认情况是root使用 <div class="cnblogs_code">
chown www-data:www-data /usr/share/nginx/html/ -R
</div>
在安装nginx时候,默认创建用户www-data用户
<div class="cnblogs_code">
cat /etc/passwd | grep www-data www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
</div>
安装mariadb数据库
<div class="cnblogs_code">
apt-get install mariadb-server mariadb-client</div> 配置mariadb数据库 <div class="cnblogs_code">
mysql_secure_installation</div> 安装PHP 插件 <div class="cnblogs_code">
apt-get install php7.0 php7.0-fpm php7.0-mysql php-common php7.0-cli php7.0-common php7.0-json</div>
PHP插件服务的启动及状态的查看
systemctl enable php7.0-fpm systemctl start php7.0-fpm systemctl status php7.0-fpm
vi /etc/nginx/sites-available/default
rm /etc/nginx/sites-enabled/default
vi /etc/nginx/conf.d/default.conf -------将以下文本粘贴到文件中。 将192.168.1.108替换为您的实际服务器IP地址。 server { listen 80; listen [::]:80; server_name 192.168.1.108; ----ip地址替换为自己的ip地址 root /usr/share/nginx/html/; index index.php index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ /index.php; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ .php$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include snippets/fastcgi-php.conf; } location ~ /.ht { deny all; } }
检查内核版本:
uname -a
1.确定系统是32位还是64位的:
getconf LONG_BIT
2.wget http://kernel.ubuntu.com/~kernel-ppa/mainline/ 下载最新的程序包
例如下载64位的4.10.2的内核:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.2/linux-image-4.10.2-041002-generic_4.10.2-041002.201703120131_amd64.deb
3.切换文件下载目录,执行命令升级:
dpkg -i linux-image-4.10.2-041002-generic_4.10.2-041002.201703120131_amd64.deb
4.更新grub引导:
update-grub
5.reboot