修改软件源
1.首先备份源列表:sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2.而后打开sources.list文件修改:sudo vim /etc/apt/sources.list
软件源可已在网上查查,有ubuntu官方的、阿里云的、清华的等
需要注意首先查看自己的ubuntu系统的codename,这一步很重要,直接导致你更新的源是否对你的系统起效果
查看方法:lsb_release -a
我的显示如下:
ubuntu@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 18.04.2 LTS
Release:18.04
Codename:bionic
ubuntu@ubuntu:~$
以上显示我的是:bionic
---- 补充了解 ----
Ubuntu 发布版本的官方名称是 Ubuntu X.YY ,其中 X 表示年份(减去2000),YY 表示发布的月份。
Ubuntu 第一个版本发布于 2004 年10月20日
|-----------------------------------------------------------------------|
| 1版本| 别名(codename) | 发布日期 |
|-----------------------------------------------------------------------|
|4.10|Warty Warthog(长疣的疣猪)|2004年10月20日|
|5.04|Hoary Hedgehog(灰白的刺猬)|2005年4月8日|
|5.10|Breezy Badger(活泼的獾)|2005年10月13日|
|6.06|Dapper Drake(整洁的公鸭)|2006年6月1日(LTS)|
|6.10|Edgy Eft(急躁的水蜥)|2006年10月6日|
|7.04|Feisty Fawn(坏脾气的小鹿)|2007年4月19日|
|7.10|Gutsy Gibbon(勇敢的长臂猿)|2007年10月18日|
|8.04|Hardy Heron(耐寒的苍鹭)|2008年4月24日(LTS)|
|8.10|Intrepid Ibex (勇敢的野山羊)|2008年10月30日|
|9.04|Jaunty Jackalope(得意洋洋的怀俄明野兔)|2009年4月23日|
|9.10|Karmic Koala(幸运的考拉)|2009年10月29日|
|10.04|Lucid Lynx(清醒的猞猁)|2010年4月29日|
|11.10|Oneiric Ocelot(梦幻的豹猫)|2010年10月13日 |
|11.04|Natty Narwhal(敏捷的独角鲸)|2011年4月28日 |
|12.04|Precise Pangolin(精准的穿山甲)|2012年的4月26日(LTS)|
|12.10|Quantal Quetzal(量子的绿咬鹃)|2012年的10月20日 |
|12.10|Quantal Quetzal(量子的绿咬鹃)|2012年的10月20日|
|13.04|Raring Ringtail(铆足了劲的猫熊)|2013年4月25日|
|13.10|Saucy Salamander(活泼的蝾螈)|2013年10月17日|
|14.04|Trusty Tahr (可靠的塔尔羊)|2014年4月18日 (LTS)|
|14.10|Utopic Unicorn(乌托邦独角兽)|2014年10月23日|
|15.04|Vivid Vervet (活泼的小猴)|2015年4月|
|15.10|Wily Werewolf (狡猾的狼人)|2015年10月|
|16.04|Xenial Xerus (好客的非洲地松鼠)|2016年4月 (LTS)|
|16.10|Yakkety Yak(牦牛)|2016年10月|
|17.04|Zesty Zapus(开心的跳鼠)|2017年4月|
|17.10|Artful Aardvark(机灵的土豚)|2017年10月|
|18.04|Bionic Beaver(仿生海狸)|2018年4月(LTS)|
|-----------------------------------------------------------------------|
---- 补充了解 ----
确软件源的支持:
这是阿里云的:http://mirrors.aliyun.com/ubuntu/dists/
该网页显示了阿里云支持的ubuntu系统下各个Codename版本,确保自己的Codename在该网页中存在(一般都会有的)
配置了软件源可以执行更新操作了:sudo apt-get update
如果报错:
E: Some index files failed to download. They have been ignored, or old ones used instead.解决方案
需要去删除旧的或者错误的软件资源列表:
删除 /var/lib/apt/lists/所有文件:sudo rm -rf /var/lib/apt/lists/*
【解决更新包错误】
Failed to fetch http://archive.ubuntu.com/ubuntu/dists/artful/main/binary-arm64/Packages 404 Not Found [IP: 91.189.88.162 80]
可能是64位系统架构的问题
【64位Ubuntu兼容32位操作】
第一步:确认64位架构的内核:dpkg --print-architecture
输出:adm64
说明已拥有64位架构内核。
第二步:确认打开了多架构支持功能:dpkg --print-foreign-architectures
输出:i386
说明已打开,如果没有需要手动打开
打开多架构支持:sudo dpkg --add-architecture i386
确认打开了多架构支持:dpkg --print-foreign-architectures
我的输出只有:i386
有的可能会是:
i386
arm64
如果要去掉一个,如去掉arm64:sudo dpkg --remove-architecture arm64
树莓派装Nginx说明
-----------------------
https://blog.csdn.net/weixin_44345526/article/details/85469276
-----------------------
安装MySQL
sudo apt install mysql-server -y
配置Mysql
sudo mysql_secure_installation
修改密码
update user set authentication_string=PASSWORD('123?abc') where user='root';
修改登录方式为密码登录
update user set plugin='mysql_native_password' where user='root';
解决MySql不能远程登录
修改/etc/mysql/mysql.conf.d/mysqld.cnf
注释掉:bind-address = 127.0.0.1
【MariaDB不能远程登录】
/etc/mysql/mariadb.conf.d/50-server.cnf
注释掉:bind-address=127.0.0.1
安装PHP
sudo apt install php-fpm php-mysql
Nginx配置
/etc/nginx/conf.d 下面有个default.conf这是默认站点,可以建多个
==============================
/etc/nginx/conf.d/default.conf 配置示例:
server {
listen 80;
server_name localhost;
index index.php index.html index.htm;
location / {
root /var/www;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000(新版本使用sock监听)
#
location ~ \.php$ {
root /var/www;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
==============================
查看php-fpm的配置:/etc/php/7.2/fpm/pool.d/www.conf
发现其中监听为sock而不是9000端口:
listen = /run/php/php7.2-fpm.sock
就要取消如下注释,来开启监听文件的权限:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
再去/var/run/php/php7.2-fpm.sock 权限改为666
sudo chmod 666 /var/run/php/php7.2-fpm.sock
测试配置有没有问题
sudo nagin -t
重载配置
sudo systemctl reload nginx
重启nginx
service nginx start
重启php
service php7.20fpm restart
OK
192.168.1.200 b8-27-eb-74-6b-1e 动态
0人点赞