分类目录:Linux

以下是分类 Linux 下的所有文章

Vesta (VPS控制面板)最小化安装 PHP+Sqlite

curl -O http://vestacp.com/pub/vst-install.sh

 

bash vst-install.sh –nginx yes –phpfpm yes –apache no –vsftpd yes –proftpd no –exim no –dovecot no –spamassassin no –clamav no –named no –iptables yes –fail2ban no –mysql no –postgresql no –remi yes –quota no

 

yum install sqlite sqlite3 php-sqlite

 

reboot

VPS CPU挖矿 LTC

任何Linux通用

 

install build-essential libcurl4-openssl-dev

install gcc make curl-devel

 

git clone https://github.com/pooler/cpuminer
cd cpuminer
./configure CFLAGS=”-O3″
make

make install

——– cpulimit

 

git clone https://github.com/opsengine/cpulimit
cd cpulimit

make
cp src/cpulimit /usr/bin

—- 脚本

 

 

vi k.sh

cpulimit -l 50 minerd –url=stratum+tcp://us.litecoinpool.org:3333 –userpass=cn3588.1:1 -t 1
~

 

注意尽量设置在-l 50-80之间,要不然vps供应商会察觉。我所有的无用VPS都设置在50,正常VPS设置在40,小流量网站的设置在20,企业网站VPS设置在10.

-t 1 , 根据CPU的个数来设定

 

 

vestacp + php7 + php5.6 (Centos)

curl -O http://vestacp.com/pub/vst-install.sh

Additional Repository 选 remi

 

—php7

 

php -v

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
如果提示有一个RPM已经安装, 需要 yum remove epel-release-7-5.noarch*
yum –enablerepo=remi update remi-release
service httpd stop
yum -y remove php
yum --enablerepo=remi-php70 install php70-php php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring
service php-fpm stop
service php70-php-fpm start
rm/usr/bin/php
ln-s /usr/bin/php70/usr/bin/php
service httpd restart
php -v
-php 5.6 (建议)
service httpd stop
yum -y remove php
#For 32 Bit OS
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
#For 64Bit OS
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
vi /etc/yum.repos.d/remi.repo
remi => 1
php56 => 1
yum -y install php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-pdo php-soap php-tidy php-xml php-xmlrpc php-pecl-apc phpMyAdmin roundcubemail php-opcache php-xdebug
service httpd start

Dropbox 备份 小型网站(使用sqlite数据库)

wget https://raw.github.com/andreafabrizi/DropboxUploader/master/dropbox_uploader.sh

chmod +x dropbox_uploader.sh

./dropbox_uploader.sh info

 

vi backup.sh

#!/bin/bash
SCRIPT_DIR=”/root”
DROPBOX_DIR=”/ovh_zq_1″
BACKUP_SRC=”/var/www”
BACKUP_DST=”/tmp”

NOW=$(date +”%Y.%m.%d”)
DATEM=$(date +”%Y_%m”)
DESTFILE=”$BACKUP_DST/$NOW.tar.gz”

tar cfz “$DESTFILE” $BACKUP_SRC

$SCRIPT_DIR/dropbox_uploader.sh upload “$DESTFILE” “$DROPBOX_DIR/$DATEM/$NOW.tar.gz”

rm -f “$DESTFILE”

 

cron来做定时任务

crontab e

0 5 * * * /bin/bash /root/backup.sh

/etc/rc.d/init.d/crond restart

Debian 安装 VNC 和 XFCE

apt-get install xfce4 xfce4-goodies gnome-icon-theme tightvncserver iceweasel

adduser vnc

apt-get install sudo

gpasswd -a vnc sudo

su – vnc

 

 

运行

vncserver

停止

vncserver -kill :1

 

 

—黑屏处理

vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

Centos 7 安装 VNC 和 GNOME 桌面 或 xfce

yum groupinstall “GNOME Desktop”

yum install tigervnc-server

cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service

vi /etc/systemd/system/[email protected]:1.service

更改

#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
#PIDFile=/home/<USER>/.vnc/%H%i.pid

ExecStart=/sbin/runuser -l root-c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid

这两行中的替换为需要通过vnc远程登录的用户名。第二行的/home/是用户的home目录;如果是root则是/root,PIDFile=/root/.vnc/%H%i.pid。

如果有防火墙

firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload


设置密码
vncpasswd
启动vnc
vncserver

启动运行
systemctl daemon-reload
systemctl enable [email protected]:1.service
reboot
systemctl start [email protected]:1.service


xfce

yum -y install epel-release
yum -y group install "Xfce"
yum -y group install "X Window System"

—黑屏处理

vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

vncserver -kill :1

vncserver

CentOS5 6 7 安装 VirtualBox

vim /etc/yum.repos.d/virtualbox.repo

 

 

[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch – VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

 

 

CentOS/RHEL 7, 64 Bit (x86_64):
# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

CentOS/RHEL 6, 32 Bit (i386):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit (x86_64):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS/RHEL 5, 32 Bit (i386):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

# yum install gcc make patch dkms qt libgomp -y
# yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel -y

export KERN_DIR=/usr/src/kernels/2.6.32-504.3.3.el6.x86_64

yum install VirtualBox-5*
service vboxdrv setup

CentOS5 安装 XFCE VNC 和 浏览器

yum groupinstall xfce-4.4

yum install vnc vnc-server

 

vi /etc/sysconfig/vncservers

添加

VNCSERVERS=”1:root”
VNCSERVERARGS[1]=”-geometry 1024×768″

vncserver

配置环境

vi /root/.vnc/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 &
#xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop”&
#twm &
startxfce4 &

开机启动
chmod +x ~/.vnc/xstartup
service vncserver restart
chkconfig vncserver on

到这里 VNC 已经可用

yum -y install firefox
yum -y install fonts-chinese