
linux
七娃Ooo
这个作者很懒,什么都没留下…
展开
-
服务器更新python3.9后使用pip的一些问题总结
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.9/distutils/__init__.py)首先搜索一下 软件源里有没有 3.9的distutils :apt search distutils然后安装 一下 apt install python3.9-distutilsAttributeError: 'HTMLParser' object has no attrib...原创 2020-11-17 20:38:56 · 3586 阅读 · 0 评论 -
python3 使用records 时没有MySQLdb
使用records时提示 ModuleNotFoundError: No module named 'MySQLdb'原因是缺少 mysqlclientpip3 install mysqlclient提示缺少 mysql_config在命令行里直接执行 mysql_config会提示程序“mysql_config”尚未安装。 您可以使用以下命令安装:apt install...原创 2019-10-31 15:17:48 · 412 阅读 · 0 评论 -
linux shell 交互代码
在shell中有时需要与用户进行交互,让用户决定是否执行这个命令,具体实现代码如下:#!/bin/bashread -p "dirname:" aread -p "make dir now?[y/n]:" selectread selectif [ $select = "y" ]then mkdir $aelse echo nothing to do;fi翻译 2016-10-12 10:02:50 · 1339 阅读 · 0 评论 -
The server quit without updating PID file (/var/run/mysqld/mysqld.pid)
错误原因是因为多了一个my.cnfmy.cnf分别位于 /etc/my.cnf /etc/mysql/my.cnf下,删除/etc/mysql/my.cnf,问题解决原创 2016-09-27 16:20:08 · 1659 阅读 · 2 评论 -
awk 命令的使用
linux awk的使用方法 awk默认的分隔符是\n或是tab键,如果想使用其它的分隔符需使用-F参数 例:cat /etc/passwd | awk -F ‘:’ ‘{print $1}’ ,这个例子使用的是’:’作为分隔符,然后print作用域1里的内容last 命令可以查看系统的登录信息 last -n 5 显示最近登录的5次信息 last -n 5|awk ‘{pri原创 2016-10-17 09:25:05 · 319 阅读 · 0 评论 -
mysql分区
CREATE TABLE IF NOT EXISTS `wj_forum` ( `fid` bigint(20) NOT NULL AUTO_INCREMENT, `ftitle` varchar(255) NOT NULL, `fcontent` text, `ftime` int(11) DEFAULT NULL, `fbigcate` varchar(50) DEFAULT原创 2016-11-09 11:15:45 · 342 阅读 · 0 评论 -
Linux CLI模式下的下载加速工具 axel
这是一款cli模式下的下载加速工具 安装可以使用aptapt-get install axel使用方法axel download-url原创 2016-10-06 09:04:26 · 596 阅读 · 0 评论 -
vim替换所有字符串
:%s/1/2/g 把所有1替换成2原创 2016-11-09 15:07:52 · 18478 阅读 · 1 评论 -
mysql Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个错误有好多种原因,其中有一种原因很简单,也很不好被发现 排除了配置文件权限等常见原因(因为服务器已经正常运行了好久,突然之前无法启动了)导致这个原因主要是因为磁盘满了,执行df可以看到/dev/mapper下已使用了100%然后我们再执行du -sh /* |sort -nr可以查看哪个文件夹占用的大,最后发现是 /var/log/squid下的日志用了36G,删除日志后 重启mysql ,原创 2016-07-27 14:19:13 · 572 阅读 · 0 评论 -
nginx+php-fpm+mysql配置后需要作的事
当运行环境安装完成后,一定要逐项进行优化,哪一项也不可以缺少 nginx 的优化:调整process的数目,以及php环境的安装 php-fpm 的优化: 调整 pool中的各项参数,最大启动进程和最小启动进程,以及初始化进程数 mysql 的优化:调整连接数 , sort_buffer_size ,myisam_sort_buffer_size (由于我用myisam)原创 2017-01-22 11:21:33 · 713 阅读 · 0 评论 -
linux 安装自定义脚本
编辑~/.bashrc文件 sudo vim ~/.bashrc加入脚本内容 alias cpx=”/home/username/cpx.sh”使配置生效 source ~/.bashrc原创 2017-06-22 11:02:27 · 543 阅读 · 0 评论 -
linux下端口被占用的解决方法
1.先查找被占用的端口netstat -tlnnetstat -tln |grep 68002.查看端口被哪个进程占用lsof -i :68003.杀死占用端口的进程kill - 9 进程id翻译 2017-10-19 15:27:20 · 1871 阅读 · 2 评论 -
apache2 ssl
1、开启SSL模块 sudo a2enmod ssl 2、启用SSL站点 sudo a2ensite default-ssl原创 2018-04-10 10:47:26 · 482 阅读 · 0 评论 -
solr7.3 的一些相关配置总结
data-config.xml配置示例:<?xml version="1.0" encoding="UTF-8" ?> <dataConfig> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jd原创 2018-05-08 10:33:45 · 1430 阅读 · 0 评论 -
apt安装nginx最新版
sudo apt-get install software-properties-commonsudo add-apt-repository ppa:nginx/stable sudo apt-get updatesudo apt-get install nginx转载 2018-06-14 15:35:01 · 3402 阅读 · 0 评论 -
solr启动时增加jvm内存,防止大数据量查询崩溃
./solr -m 2g 为虚拟机分配2g大小的内存转载 2018-09-01 09:07:42 · 3424 阅读 · 1 评论 -
ant编译nutch Could not load definitions from resource org/sonar/ant/antlib.xml
ant 编译 nutch时出现 Could not load definitions from resource org/sonar/ant/antlib.xml出现这个的原因是找不到对应的jar包解决方法:1,下载 sonar-ant-task-2.2.jar2.放入到 lib 文件夹下3.修改 ivy/ivysettings.xml大概888行处, 为: <...原创 2019-01-10 19:51:40 · 2504 阅读 · 1 评论 -
ubuntu挂载新硬盘的方法
查看硬盘列表 sudo fdisk -l为新硬盘添加分区 sudo fdisk /dev/sdb n:添加新分区 p:使用主分区 l:主分区编号为1,这样创建的分区为sdb1格式化新分区 sudo mkfs ext4 /dev/sdb1 #使用ext4格式化sdb1分区随意创建一个文件夹,将新分区挂载上去 sudo mkdir /disk2 sudo moun原创 2016-09-19 15:08:04 · 10764 阅读 · 0 评论 -
nohup重定向到其它的日志文件
如果使用nohup命令提交作业,那么在缺省情况下该作业的所有输出都被重定向到一个名为nohup.out的文件中,除非另外指定了输出文件:nohup command > myout.file 2>&1 &在上面的例子中,输出被重定向到myout.file文件中。转载 2016-08-30 10:54:45 · 19522 阅读 · 1 评论 -
yum安装lamp
1. 安装Apahce, PHP,以及php连接mysql库组件。 yum -y install httpd php php-mysql 2. 配置开机启动服务 /sbin/chkconfig httpd on [设置apache服务器ht转载 2011-08-03 15:57:28 · 581 阅读 · 0 评论 -
php5.3 安装mcrypt
For me the answer was:1) Get the Repos from wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmwget http://rpms.famillecollet.com/enterprise/remi-release-6.rpmsudo rpm转载 2013-10-07 12:59:52 · 1335 阅读 · 0 评论 -
iptables 开放80端口
iptables -F iptables -A INPUT -p tcp --dport 22 -j ACCEPT /*允许包从22端口进入*/ iptables -A OUTPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT /*允许从22端口进入的包返回*/ iptables -A OUTPUT -p udp -转载 2013-10-07 13:29:14 · 1051 阅读 · 0 评论 -
nginx配置yii的安全
需要禁止protected以及framework两个文件夹下以及其子文件夹下的访问,配置如下: location ^~/protected{ deny all;}原创 2013-11-09 14:49:10 · 850 阅读 · 0 评论 -
yum 下安装mcrypt 找不到package 的解决办法
由于种种原因,让我在配置服务器的时候喜欢使用yum来进行安装 可是在安装完php后,yum源里已经再也找不到mcrypt扩展了,这会使加密的功能无法使用我的解决方法如下: 1.到php.net去下载和你现在的php版本相对应的php源码包,如当前php版本为5.3.3,那么请下载php-5.3.3.tar.gz类似这样的包 2.进入源码包编译mcrypt扩展,并且进行安装,原创 2014-02-20 16:52:01 · 1503 阅读 · 0 评论 -
ubuntu开启模块的方法
sudo a2enmod ssl 开启sslsudo a2enmod rewrite 开启rewritea3enmod 就是开启模块的意思原创 2015-03-27 16:53:34 · 967 阅读 · 0 评论 -
apache在添加了新的端口号后被提示没有权限绑定到这个端口
如题,这种问题的原因是因为selinux的原因,没有开放相应的端口,解决方法我是从网上找到的,需要安装semanage,具体解决方法如下根据自己的需求在selinux中添加需要指定的端口前提需要先安装semanage(Centos6.0默认没有安装该应用) a)安装方式如下:[root@localhost /]# yum provides /usr/sbin/sema转载 2015-03-28 10:42:16 · 1488 阅读 · 0 评论 -
linux使用putty连接后,后台运行程序的方法
使用Putty等客户端连接到服务器后,单纯使用“&”不能在后台运行程序,因为只要Putty一退出程序也会随着退出。解决方法:使用nohub,例: nohup php service.php &让php程序像服务一样运行在后台,这样就可以使用php或python等写服务了,停止时直接killall 就好了原创 2015-03-24 10:36:27 · 6952 阅读 · 0 评论 -
ubuntu 下安装 php mcrypt扩展
apt-get install php5-mcrypt libmcrypt-devphp5enmod mcrypt原创 2015-10-19 13:53:37 · 4976 阅读 · 0 评论 -
Ubuntu下搭建svn服务器 subversion
安装软件包:sudo apt-get install subversion之后选择SVN服务文件及配置文件的放置位置。我放在了/srv下的svn目录。cd /srvsudo mkdir svn我的svn版本仓库叫tone_srccd /srv/svnsudo mkdir tone_src目录建好后 创建版本仓库sudo svnadmin create /srv/转载 2015-10-19 13:58:03 · 409 阅读 · 0 评论 -
ubuntu下apt-get安装nginx后的升级
ubuntu apt-get 安装完nginx后是1.4.6版的,以下是对该版本的升级以下信息来源于网络Nginx Stable PPA是由Ubuntu社区维护的源,本源更新自稳定版分支,是Kaijia目前使用的源,这个源的特点是文件的目录结构和Ubuntu自带的Nginx相同,因此安装这个版本时不需要修改/etc/nginx/下面的配置文件。不过这个源更新比较慢,一般Nginx原创 2015-11-20 13:00:27 · 4601 阅读 · 0 评论 -
apt-get 为apache安装xsendfile mod
apt-get install libapache2-mod-xsendfile同理其它的mod都可以这样安装原创 2016-01-16 11:32:20 · 826 阅读 · 0 评论 -
git命令的简单使用方法
克隆远程地址git clone git@远程地址或者初始化一个git库git init添加文件到git中git add test.php提交git commit -m "备注内容"往远程服务器中的master分支中pushgit push origin master查看文件状态git status原创 2016-03-17 16:03:07 · 375 阅读 · 0 评论 -
linux 下计划任务的作法
linux 下的计划任务可以使用crontab首先 crontab -e 进入编辑模式选择vim编辑器进行编辑即可,例:0 * * * * python aa.py每个小时的0分钟,即每小时执行一次 python aa.py这个命令原创 2016-03-28 10:39:12 · 535 阅读 · 0 评论 -
php curl采集时 curl connect error
php 用curl作采集服务时,返回的数据为空,throw new Exception(curl_error($this->_curl), curl_errno($this->_curl)); 抛出异常信息后显示 curl connect error,经phpinfo比对后发现 可用的服务器 curl 是openssl ,不可用的curl 是nss也可以使用curl -V命令来查看,发现里原创 2016-05-16 11:32:36 · 1890 阅读 · 0 评论 -
mysql 得用mysqlbinlog恢复数据
进入到mysql的安装目录中的bin文件夹,里面会有mysqlbinlog命令,只有这样才能正常使用,命令格式如下:./mysqlbinlog 文件路径 stop-date="具体日期,精确到秒"如./mysqlbinlog /usr/local/mysql/var/mysql-bin.000011 stop-date="2016-06-18 13:00:00"则可原创 2016-06-19 18:27:33 · 1692 阅读 · 0 评论 -
linux yum安装mysql后要注意的一些初始化问题
1. 配置开机启动服务/sbin/chkconfig httpd on [设置apache服务器httpd服务开机启动]/sbin/chkconfig –add mysqld [在服务清单中添加mysql服务]/sbin/chkconfig mysqld on [设置转载 2011-08-03 15:58:37 · 766 阅读 · 0 评论