博文

目前显示的是标签为“debian”的博文

debian显示内存占用前十的进程

ps aux | sort -k4,4nr | head -n 10 pmap $(pgrep php-cgi | head -1) //查看PHP-CGI占多大的内存

debian 安装php-memcached扩展

memcached 安装 sudo apt-get install memcached memcached 参数说明 memcached -d -m 50 -p 11211 -u root -m 指定使用多少兆的缓存空间;-p 指定要监听的端口; -u 指定以哪个用户来运行 安装php-memcache模块 sudo apt-get install php5-memcache 编辑配置文件 sudo vi /etc/php5/conf.d/memcache.ini ;uncomment the next line to enable the module extension=memcache.so [memcache] memcache.dbpath=”/var/lib/memcache” memcache.maxreclevel=0 memcache.maxfiles=0 memcache.archivememlim=0 memcache.maxfilesize=0 memcache.maxratio=0

解决debian下logitech c170的问题

apt-get install guvcview

debian apt-get update:public key 错误修复

apt-get update 出现 这种错误 Reading package lists… Done W: There is no public key available for the following key IDs: 7638D0442B90D010 W: There is no public key available for the following key IDs: 7638D0442B90D010 W: There is no public key available for the following key IDs: 9D6D8F6BC857C906 解决方法 apt-get install debian-keyring debian-archive-keyring apt-get update

Blocking abusive IP addresses using IPTABLES Firewall in Debian

In one of our previous article we have posted an instructional guide on how to secure your Debian/Ubuntu based VPS using IPTABLES/Netfilter. In the following article we are adding a blacklist to the firewall script which will allow you to block any abusive IP addresses or ranges of IPs in your Debian or Ubuntu based virtual server. What is iptables? It is is a user space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores. Before proceeding any further, make sure you read the article on how to secure/design the firewall in your linux vps. This includes: Flushing the old firewall rules Determining service ports Setting-up default policies Setting-up your firewall rules Saving your firewall rules BLOCKING IPs USING IPTABLES To block some abusive IP address or range of IPs, you can use the following iptables rules: ## iptables -I INPUT -s 1.2.3.4...

How to mount Google Drive on debian

图片
apt-get install ocaml camlp4-extra git clone https://github.com/OCamlPro/opam.git cd opam ./configure make sudo make install apt-get install m4 libcurl4-gnutls-dev libfuse-dev libsqlite3-dev opam init //**if error( opam init https://opam.ocaml.org/1.1 ) opam update opam install google-drive-ocamlfuse 安装成功后,进入Google Project建立一个Project https://console.developers.google.com/project 进入项目的API设置开启Drive API 建立一个OAuth验证ID 建立项目的Client ID 记录下这两个生成的参数做稍后使用 进入/root/.opam/system/bin/目录绑定项目 cd /root/.opam/system/bin/ ./google-drive-ocamlfuse -headless -label googledrive -id ##Client ID##.apps.googleusercontent.com -secret ##secret key## 执行完上述指令会返回一个https的网址在浏览器粘贴到浏览器后会进入google页面询问是否允许访问该项目,选accept然后记录下浏览器页面返回的密码,粘贴进去回车即可。 进入~/.gdfuse/googledrive cd ~/.gdfuse/googledrive nano config 编辑config修改内容例如 verification_code= [key returned from browser] client_id= [eg. 123123231.apps.googleusercontent.com] client_secret= [eg. ASDQWEWGSD!$@#@#ASD] 完成配置加载Google Drive远端存储到本地/googledrive mkdir /googledrive cd ~/.o...

debian gnome

aptitude search gnome|grep gir1.2-gnomebluetooth-1.0 – Introspection data for GnomeBluetooth gir1.2-gnomekeyring-1.0 – GNOME keyring services library – introspec gnome – Full GNOME Desktop Environment, with extra gnome-accessibility-themes – Accessibility themes for the GNOME desktop gnome-applets – Various applets for the GNOME panel – bina gnome-applets-data – Various applets for the GNOME panel – data gnome-backgrounds – Set of backgrounds packaged with the GNOME gnome-bluetooth – GNOME Bluetooth tools gnome-brave-icon-theme – blue variation of the GNOME-Colors icon th gnome-cards-data – data files for the GNOME card games gnome-color-manager – Color management integration for the GNOME gnome-colors-common – common icons for all GNOME-Colors icon the gnome-common – common scripts and macros to develop with gnome-contacts – Contacts manager for GNOME gnome-control-center – utili...

Debian: dmesg output contains “Error: Driver ‘pcspkr’ is already registered, aborting…”

解决方法: aptitude install alsa-base echo blacklist snd-pcsp >> /etc/modprobe.d/alsa-base-blacklist.conf 如果alsa-base-blacklist.conf文件里有blacklist snd-pcsp就不必执行echo了    

Could not load host key: /etc/ssh/ssh_host_ecdsa_key

debian service ssh restart 出现Could not load host key: /etc/ssh/ssh_host_ecdsa_key 解决方法: dpkg-reconfigure openssh-server

debian Shadowsocks Supervisor

执行 apt-get install python-pip python-m2crypto supervisor pip install shadowsocks   服务端安装好以后,创建一个配置文件 /etc/shadowsocks.json。 示例:   { “server”:”服务器 IP 地址”, “server_port”:8388, “local_address”: “127.0.0.1”, “local_port”:1080, “password”:”mypassword”, “timeout”:300, “method”:”aes-256-cfb”, “fast_open”: false, “workers”: 1 }  多用户配置文件 { “server”:”your_server_ip”, “local_address”: “127.0.0.1”, “local_port”:1080, “port_password”:{ “8989”:”password0″, “9001”:”password1″, “9002”:”password2″, “9003”:”password3″, “9004”:”password4″ }, “timeout”:60, “method”:”aes-256-cfb”, “fast_open”: false, “w...

/bin/false and /usr/sbin/nologin

要拒绝系统用户登录,可以将其shell设置为/usr/sbin/nologin或者/bin/false   # usermod -s | –shell /usr/sbin/nologin username 或者   # usermod -s | -shell /bin/false username /bin/false   /bin/false什么也不做只是返回一个错误状态,然后立即退出。将用户的shell设置为/bin/false,用户会无法登录,并且不会有任何提示。   /usr/sbin/nologin   nologin会礼貌的向用户显示一条信息,并拒绝用户登录:   This account is currently not available.   有一些软件,比如一些ftp服务器软件,对于本地非虚拟账户,只有用户有有效的shell才能使用ftp服务。这时候就可以使用nologin使用户即不能登录系统,还能使用一些系统服务,比如ftp服务。/bin/false则不行,这是二者的重要区别之一。   /etc/nologin   如果存在/etc/nologin文件,则系统只允许root用户登录,其他用户全部被拒绝登录,并向他们显示/etc/nologin文件的内容。   锁定用户账户   # passwd -l | –lock username #解锁用户账户   # passwd -u | –unlock username 删除用户密码   # passwd -d | –delete username ===

Debian下OpenVPN的搭建

图片
apt-get install openvpn cp -R /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn cd /etc/openvpn/easy-rsa/2.0 source vars ./clean-all ./build-ca ./build-key-server server ./build-key client1 ./build-dh 注意:上面操作全部直接回车即可,如果有选择Y/N的 全部选择Y即可。 OpenVPN需要tun和iptables_nat模块支持,所以先检查你的VPS支持不支持。 SSH登陆VPS后输入 cat /dev/net/tun 若返回信息为:cat: /dev/net/tun: File descriptor in bad state 说明tun/tap已经可以使用; 如果返回:cat: /dev/net/tun: No such device 或其他则说明tun/tap没有被正确配置,发TK联系客服申请开通tun/tap。 apt-get install iptables #如已安装跳过 如果你的VPS是Xen或KVM的请输入:(eth0要根据具体的网卡标识来,可以通过ifconfig查看) iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE 如果是OpenVZ的请输入:(11.22.33.44是你VPS的IP) iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j SNAT –to-source 11.22.33.44 iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o venet0 -j SNAT –to 11.22.33.44 //注意如果是venet0 修改vi /etc/sysctl.conf net.ipv4.ip_forward=1 用sysctl –p使其生效 然后用 iptables -t nat -L 查看iptables转发状态,如果显示以下类似的结果则说明转发成功: target prot opt source destination SNAT all ...

Debian google chrome安装java插件

首先到java官网下载相对应的Linux版本的java。下载地址:http://www.java.com/zh_CN/download/manual.jsp?locale=zh_CN 然后解压 tar zxfv <file name>,记住解压目录,如:/usr/local/java/jre<version>/ mkdir /opt/google/chrome/plugins/ ln -s /usr/local/java/jre<version>/lib/i386/libnpjp.so /opt/google/chrome/plugins/ chrome://plugins/可以看到java插件已经安装完成,刷新google chrome即可运行java插件。

Debian有线网络未托管

有线网络未托管,这种情况是系统认识网卡但未激活它,修改一下配置文件就好了! 在终端中输入sudo gedit /etc/NetworkManager/NetworkManager.conf 将最后一行的false修改为true,重启即可

给pidgin安装pidgin-lwqq插件

pidgin很好安装,源里面有,直接aptitude install pidgin即可安装完成。 pidgin-lwqq安装则较为麻烦一点。首先git clone https://github.com/xiehuc/pidgin-lwqq.git pidgin-lwqq,如果没有git的先安装aptitude install git ,然后再安装pidgin-lwqq所需要的依赖包apt-get install build-essential cmake pkg-config libglib2.0-dev libcurl4-openssl-dev libpurple-dev。安装完这些依赖包后开始编译: git submodule init git submodule update mkdir build;cd build cmake .. make sudo make install

Debian不能添加VPN?

图片
一直用windows 桌面,添加VPN客户端只需要上控制面板点几下就OK,今天在debian桌面上想VPN一下出去透透气,可是在网络配置里的添加VPN按钮是灰色的。如下图 找了半天终于找到解决方法了:apt-get install network-manager-pptp-gnome

debian安装后更新源设置

最近在本本上安装体验一下debian7,安装完后与往常一样还是选择用163镜像源,可是163的镜像源总是有那么点不完美,最后加入几个地址,感觉不错,记录一下,以后备用 deb http://mirrors.163.com/debian wheezy main non-free contrib deb http://mirrors.163.com/debian wheezy-proposed-updates main contrib non-free deb-src http://mirrors.163.com/debian wheezy main non-free contrib deb-src http://mirrors.163.com/debian wheezy-proposed-updates main contrib non-free deb http://mirrors.163.com/debian-security wheezy/updates main contrib non-free deb-src http://mirrors.163.com/debian-security wheezy/updates main contrib non-free deb http://http.us.debian.org/debian wheezy main contrib non-free deb http://security.debian.org wheezy/updates main contrib non-free deb http://www.deb-multimedia.org wheezy main non-free deb http://ftp.de.debian.org/debian jessie main

debian清除无用的库文件

deborphan 可以用来找出在系统中已经没有被依赖的套件。一般的情况是 library 会在其他套件需要的时候被牵引进来,但是当这些套件升级或删除后,被牵引进来的 library package 都不会同时被删除。因此,久而久之,系统里就存在了很多的所谓 orphaned packages,就是说这些 library packages 已经被遗弃了的意思。其中一个解决方法就是使用 deborphan 来找出它们并删除之。   安装deborphan apt-get install deborphan 运行deborphan –show-section –show-priority –show-size 或者简洁一点:$ deborphan -sPz,查看有没有多余的库。   删除无用的库文件:apt-get remove –purge `deborphan` ( 清除系统多余的 library )   当您使用 debian 一段时间后,如果您经常安装、移除软件一定会出现残余 library 在系统的状况,原因是当您安装软件时, debian 依照软件相依特性安装了额外的 library,但是当您移除该软件时,当初连带安装的 library 不见得会一起被移除,久而久之系统就会出现残余的 library,这个时候您便可以下这行指令,为您扫除系统中无用的 library ,确保系统的清洁性。

在Debian里面用quota配置磁盘限额

实现磁盘配额限制步骤: 1. 内核里面打开了配额的支持,绝大部分发行版都打开的 2. 以配额方式加载文件系统 3.安装配额软件: 4.配置配额 原/etc/fstab的一项: /dev/hda1 /home ext2 defaults 1 1 做如下修改: /dev/hda1 /home ext2 defaults,usrquota 1 1 如何是对组限制就将usrquota改为grpquota 重新加载文件系统: mount -o remount,usrquota /home 加载内核模块,并让其开机的时候也会自动加载 modprobe quota_v2 echo ‘quota_v2’ >> /etc/modules 我们要在启用配额的分区创建文件并且限制root才能读写 touch /home/aquota.user touch /home/aquota.group chmod 600 /home/aquota.user /home/aquota.group 现在来安装quota软件: apt-get install quota quotatool 如果不想重起机器来打开磁盘配额 quotacheck -vagum 现在到最后一步了,假设我们要对系统里的某个用户skx进行限制配额: quotatool -u skx -bq 200M -l ‘250 Mb’ /home 系统管理员可以用如下命令看到 磁盘配额 repquota /home 如果想把一个用户的限制取消只用把他的限制配额设为0 对了,如果是20G,那就要写20000M,quotatool好像不认 20G的。 收工~~ 其实现在一般情况下也用不到这个磁盘限额。

debian 6 安装vnc+xfce4 教程

debian6 不得不说,非常好的系统,默认安装的时候,不安装图形,安装一些基本的包后,以后如果想安装图形,远程管理什么的,可以安装xfce这个桌面,非常小,然后把中文安装上,非常爽。安装的步骤如下: apt-get install xfonts-intl-chinese xfonts-wqy ttf-wqy-zenhei ttf-wqy-microhei apt-get install vnc4server xfce4 安装完成以后,配置下vnc,让vnc 开机自动启动,并设置一个vnc的连接密码 终端输入vncpasswd ,提示输入密码即可 远程访问客户端可以用vncviewer ,但在访问前还需修改一个 VNC 的 xstartup 文件,否则没有Xfce图像界面 vim ~/.vnc/xstartup 附我的 xstartup 文件 #!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey #vncconfig -iconic & #x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” & #x-window-manager & xfce4-session & 然后创建一个启动脚本 vim /etc/init.d/vncserver #! /bin/sh export USER=”root” export PATH=”/usr/local/bin:/usr/bin:/bin:/usr/bin/X11″ NAME=vncstart start() { su – $USER -c”...