开启EPEL仓库

EPEL(Extra Packages for Enterprise Linux)是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供他们默认不提供的软件包。

1
2
3
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum update

安装git

1
sudo yum install git

安装zsh

1
sudo yum install zsh

安装oh my zsh

1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

安装开发工具

1
sudo yum groupinstall "Development Tools"

安装cmake

1
sudo yum install cmake

安装JDK

1
2
3
4
sudo rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.181-2.6.14.8.el7_5.x86_64
sudo rpm -e --nodeps java-1.7.0-openjdk-1.7.0.181-2.6.14.8.el7_5.x86_64
sudo yum install java-1.8.0-openjdk-devel
sudo yum install java-1.8.0-openjdk-accessibility java-1.8.0-openjdk-demo java-1.8.0-openjdk-javadoc java-1.8.0-openjdk-src

安装SVN

1
sudo yum install subversion

安装tomcat

1
sudo yum install tomcat

安装mariadb

1
sudo yum install mariadb mariadb-server

设置开机启动

1
sudo systemctl enable mariadb

配置mariadb字符集,修改/etc/my.cnf,在[mysqld]标签下面添加以下内容

1
2
3
4
5
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

修改/etc/my.cnf.d/client.cnf,在[client]标签添加

1
default-character-set=utf8

修改/etc/my.cnf.d/mysql-clients.cnf ,在[mysql]标签添加

1
default-character-set=utf8

启动mariadb

1
sudo systemctl start mariadb
简单配置mariadb

1
mysql_secure_installation

进入mariadb查看字符集

1
2
SHOW VARIABLES LIKE '%character%';
SHOW VARIABLES LIKE '%collation%';

添加用户,设置权限

1
2
3
CREATE USER test@localhost IDENTIFIED BY 'test901120';
DELETE FROM user WHERE USER="test" AND HOST="localhost";
GRANT ALL ON *.* TO test@'%' IDENTIFIED BY 'test901120';

防火墙开启3306端口

1
2
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --reload

centos7防火墙命令

查看已经开放的端口:

1
sudo firewall-cmd --list-ports

开启端口:

1
firewall-cmd --zone=public --add-port=80/tcp --permanent

重启防火墙:

1
2
3
4
sudo firewall-cmd --reload
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
sudo firewall-cmd --state

安装emacs

CentOS7软件仓库里面的emacs版本是24的,版本低了一点,所以选择编译安装一个最新版的。删除原来的emacs

1
2
sudo yum remove emacs
sudo yum autoremove

下载emacs-26.1.tar.gz,http://mirrors.ustc.edu.cn/gnu/emacs。

1
2
3
4
5
tar zxf emacs-26.1.tar.gz
cd emacs-26.1
./configure --prefix=/usr/local
make
sudo make install

编译过程中可能会出错,提示缺少一些库,只需按照提示安装相应的开发库即可。可能会缺少的库如下

1
2
3
4
5
6
7
gtk3-devel
libXpm-devel
libjpeg-turbo-devel
giflib-devel
libtiff-devel
gnutls-devel
ncurses-devel

安装spacemacs

1
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

下载IDEA

下载地址:http://www.jetbrains.com/idea/download/

解压ideaIU-2018.1.5.tar.gz

1
tar zxf ideaIU-2018.1.5.tar.gz

激活IDEA

下载JetbrainsCrack-2.8-release-enc.jar,将它拷贝到idea的bin目录下面,编辑idea64.vmoptions,在最后添加如下内容:

1
-javaagent:/YourPath/idea-IU-181.5281.24/bin/JetbrainsCrack-2.8-release-enc.jar

运行bin目录下面的idea.sh启动idea,然后在激活码输入任意字符激活idea。

安装nginx

1
sudo yum install nginx

启动nginx并设置开机启动

1
2
sudo systemctl start nginx
sudo systemctl enable nginx

防火墙开启80端口

1
2
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload

安装redis

1
sudo yum install redis

安装keepassx2

Keepassx是一个跨平台的密码管理工具,平时都用它来存储各个网站的账号密码,以防忘记

1
sudo yum install keepassx2

centos桌面美化

删除底部栏

1
2
cd /usr/share/gnome-shell/extensions
sudo mv window-list@gnome-shell-extensions.gcampax.github.com window-list@gnome-shell-extensions.gcampax.github.com.bak

隐藏顶栏(不建议)

修改/usr/share/gnome-shell/modes/classic.json

1
2
cd /usr/share/gnome-shell/modes
sudo cp classic.json classic.json.back

修改panel为:

1
2
3
4
"panel": { "left": [],
               "center": [],
               "right": []
             }

修改/usr/share/gnome-shell/theme/gnome-classic.css

1
2
cd /usr/share/gnome-shell/theme
sudo cp gnome-classic.css gnome-classic.css.bak

修改panel为:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#panel {
    background-color: #e9e9e9;
    background-gradient-direction: vertical;
    background-gradient-end: #d0d0d0;
    border-top-color: #666; /* we don't supportnon-uniform border-colors and
                               use the top bordercolor for any border, so we
                               need to set iteven if all we want is a bottom
                               border */
    border-bottom: 1px solid #666;
    app-icon-bottom-clip: 0px;
     color: transparent;
     /* hrm, still no multipoint gradients
      background-image: linear-gradient(left,rgba(255, 255, 255, 0),rgba(255, 255, 255, 1) 50%,rgba(255, 255, 255, 0)) !important;*/
   }

安装chromium

1
sudo yum install chromium

安装shadowsocks客户端

1
2
3
sudo yum install python-pip
sudo pip install --upgrade pip # 升级pip
sudo pip install shadowsocks

启动shadowsocks客户端

1
nohup sslocal -s your_server_ip -p your_server_port -l 1080 -k your_server_passwd -t 600 -m rc4-md5 > /dev/null 2>&1 &

为了更方便,建议新建一个json的文件,将上述信息放里面,比如/etc/shadowsocks.json内容为:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
    "server":"your_server_ip",      #ss服务器IP
    "server_port":your_server_port, #端口
    "local_address": "127.0.0.1",   #本地ip
    "local_port":1080,              #本地端口
    "password":"your_server_passwd",#连接ss密码
    "timeout":300,                  #等待超时
    "method":"rc4-md5",             #加密方式
    "fast_open": false,             # true  false。如果你的服务器 Linux 内核在3.7+,可以开启 fast_open 以降低延迟。开启方法: echo 3 > /proc/sys/net/ipv4/tcp_fastopen 开启之后,将 fast_open 的配置设置为 true 即可
    "workers": 1                    # 工作线程数
}

安装privoxy

1
sudo yum install privoxy