Liang 发布的文章

Ubuntu 18.04更换国内镜像源提高安装更新速度

Ubuntu18.04默认安装完以后镜像是官方的,国内更新速度太慢,更新为阿里云或中科大等其他国内源,速度会明显提高,操作方法如下:
备份原文件:

cp /etc/apt/sources.list /etc/apt/sources.list_bak

将/etc/apt/sources.list文件内容替换为如下:(任意其一即可)
阿里云镜像源

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

网易镜像源

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

中科大镜像源

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

更新系统及软件

sudo apt-get update

sudo apt-get upgrade

后面在安装软件速度就很快了~.

192 MB的VPS上安装ss服务基于Ubuntu16.04

在内存只有192MB小鸡vps上安装ss服务,基于ubuntu16.04精简版,安装脚本命令如下:

apt-get update

pip install -U pip

pip3 install --upgrade pip

pip3 install shadowsocks

pip install --upgrade shadowsocks

pip3 install --upgrade shadowsocks
     
cat <<EOF>> /etc/shadowsocks.json
{
    "server":"vps ipadder",
    "local_address":"127.0.0.1",
    "local_port":8888,
    "port_password":{
         "9001":"password",
         "9002":"password"
    },
    "timeout":600,
    "method":"aes-256-cfb",
    "fast_open": false
}
EOF

/usr/local/bin/ssserver -c /etc/shadowsocks.json >> /ss.log 2>&1 &

---阅读剩余部分---

pip升级后出现"from pip import main" line 9问题的解决方法

在Ubuntu或CentOS中,升级了pip版本,再次使用pip 安装相关的包的时候就出现以下错误

Traceback (most recent call last): 
File “/usr/bin/pip”, line 9, in <module>
from pip import main

解决:pip文件在usr/bin目录下,cd进去,进行以下修改

from pip import main
if __name__ == '__main__':
    sys.exit(main())

换成下面的三行

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

然后问题就解决了;
pip3也是一样;

使用国内镜像源 提高pip安装更新速度

不论是使用 pip,还是 Pipenv、Poetry等工具,安装 Python 包的时候会默认从官方的 PyPI 源下载文件,速度比较慢。国内的一些公司和机构提供了 PyPI 镜像源(mirror source),你可以设置让这些工具从国内的镜像源安装 Python 包,以便提高下载速度。

官方 PyPI 源的 URL 为 https://pypi.org/simple (旧的 URL 为 https://pypi.python.org/simple

pip更换临时设置可以通过 -i 选项:

pip install -i https://mirrors.aliyun.com/pypi/simple/ flask

永久更换:
Windows系统:
首先在window的文件夹窗口输入 : %APPDATA%



---阅读剩余部分---

MySQL子查询参数说明

MySQL查询的五种子句

where子句(条件查询):按照“条件表达式”指定的条件进行查询。

group by子句(分组):按照“属性名”指定的字段进行分组。group by子句通常和count()、sum()等聚合函数一起使用。

having子句(筛选):有group by才能having子句,只有满足“条件表达式”中指定的条件的才能够输出。

order by子句(排序):按照“属性名”指定的字段进行排序。排序方式由“asc”和“desc”两个参数指出,默认是按照“asc”来排序,即升序。

limit(限制结果集)。

---阅读剩余部分---

Nginx 414 Request-URI Too Large报错解决方法

症状:前台客户端发送大量请求或发送的数据包太大的时候,nginx会报nginx 414 Request-URI Too Large错误,如下图
1.png
检查Log里面显示有大量报错

2019/04/09 15:03:32 [error] 21197#0: *90489 client intended to send too large body: 1470779 bytes, client: 124.74.25.254, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index"
2019/04/09 15:22:37 [error] 21200#0: *90745 client intended to send too large body: 1376065 bytes, client: 114.86.94.252, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index"
2019/04/10 09:08:46 [error] 21200#0: *91741 client intended to send too large body: 1470779 bytes, client: 124.74.25.254, server: zt-test.xxx.cn, request: "POST /cinema/salesman/save HTTP/1.1", host: "zt-test.xxx.cn:8080", referrer: "http://zt-test.xxx.cn:8080/index


---阅读剩余部分---

AWS镜像AMI制作

先在本地安装Oracle VM VirtualBox,安装好虚拟机(调整优化系统各个参数)此处不再赘述,IP设置为自动获取,最后关机导出,格式为“开放式虚拟化格式 1.0”,如下图,导出完以后上传到S3存储上;

---阅读剩余部分---

Django2.x删除表后重建

Django框架中删除表,正确的方法步骤如下:
1、进入数据库中,如MySQL中删除表

drop table tablename;

2、注释django中对应的Model和引用该Model对应的代码,然后执行:

python manage.py makemigrations   
python manage.py migrate --fake

d1.jpg
3、去掉刚才的注释重新同步数据即可。

python manage.py makemigrations   
python manage.py migrate

Oracle 错误号解释大全

ORA-00001: 违反唯一约束条件 (.)
ORA-00017: 请求会话以设置跟踪事件
ORA-00018: 超出最大会话数
ORA-00019: 超出最大会话许可数
ORA-00020: 超出最大进程数 ()
ORA-00021: 会话附属于其它某些进程;无法转换会话
ORA-00022: 无效的会话 ID;访问被拒绝
ORA-00023: 会话引用进程私用内存;无法分离会话








---阅读剩余部分---

干冬

过年回老家过年,听说一冬天没下雪,干了一冬,空气干燥,流感肆掠;

农村经济萧条,年轻人80%都外出务工看,剩下的只有老弱病残和留守儿童,国内贫穷落后的农村大部分如此相似;

在要离开的前一天晚上终于下了一场雪,万物一片白;

---阅读剩余部分---

Linux下快速PHP编译安装fileinfo扩展

1、进入对应php版本扩展目录:

cd /opt/php-7.2.12/ext/fileinfo

2、编译及安装

/usr/local/php/bin/phpize
./configure -with-php-config=/usr/local/php/bin/php-config
make
make install

3、修改php.ini

extension = fileinfo.so

4、重启php-fpm生效

systemctl restart php-fpm

CentOS7.x禁用 rpcbind 111端口

 CentOS7.x新安装版本后会使用systemd进程启用rpcbind监听111端口,NFS需要用到这个服务,一般可以禁用掉,使用如下:

//停止进程
systemctl stop rpcbind.socket
systemctl stop rpcbind

//禁止随开机启动
systemctl disable rpcbind.socket 
systemctl disable rpcbind

rpcbind说明:

---阅读剩余部分---

冬日阳光

魔都下了一个月的冬雨,太潮湿,人的心灵和肉体都快发霉了;

阳光终于出来了,忽然觉得能晒到太阳也是一种很奢侈的事情;

早出晚归,终日不见阳光;

阳光底下散散步挺好,让心别发霉。

---阅读剩余部分---

impdp导入还原命令详解

Oracle数据库还原IMPDP命令是相对于EXPDP命令的,方向是反向的。即对于数据库备份进行还原操作。

[oracle@ehrtest108 ~]$ impdp -help

Import: Release 11.2.0.4.0 - Production on чǚ̄ 1Ղ 17 13:48:33 2019

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


The Data Pump Import utility provides a mechanism for transferring data objects
between Oracle databases. The utility is invoked with the following command:

     Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp

You can control how Import runs by entering the 'impdp' command followed
by various parameters. To specify parameters, you use keywords:

     Format:  impdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
     Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp

USERID must be the first parameter on the command line.

参数说明:

---阅读剩余部分---

最新

分类

归档

评论

  • 安安: 都是af
  • Liang: 嗯,有点不通顺·
  • 王庭威: “MySQL互为主从...
  • Liang: 贴下编译参数和步骤,...
  • shao3911: 您好,为什么我在编译...
  • aliang: 先看是yum安装还是...
  • aliang: 将原来的nginx安...
  • yen: 3、如果要回滚的话,...
  • yen: 刚好需要升级ngin...
  • 文雨: 一些新的method...

其它