月度归档:2014年07月

fedora开放环境一键安装

sudo不需要密码

visudo

%wheel  ALL=(ALL)       NOPASSWD: ALL

开发环境

yum groupinstall "Development tools" -y

右键打开控制台窗口

yum install nautilus-open-terminal

禁止selinux

setenforce 0 

vi /etc/selinux/config

SELINUX=disabled

安装vscode

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'

vim & git & hg & svn

yum install vim git hg subversion

nginx & php & mysql

yum install mariadb nginx php-cli php-devel php-mbstring php-opcache php-mysqlnd php-intl php-mcrypt php-pdo php-xml php-pecl-memcache  php-pecl-redis php-pecl-sphinx php-pecl-zip php-pgsql php-xdebug php-gd  php-pecl-redis  php-pecl-imagick  php-fpm

python

yum install python-virtualenv pyvenv ~/py cd ~/py/bin source activate wget https://bootstrap.pypa.io/get-pip.py python get-pip.py

golang

wget http://golang.org/dl/go1.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.3.linux-amd64.tar.gz 
mkdir ~/gosrc
vim ~/.bash_profile

设置GOROOT与GOPATH

GOPATH=$HOME/gosrc
GOROOT=/usr/local/go
export GOROOT
export GOPATH
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH

修改系统参数

vi /etc/sysctl.conf

fs.file-max = 500000

vi /etc/security/limits.conf

* soft nofile 60000
* hard nofile 60000

vi /etc/security/limits.d/90-nproc.conf

*          soft    nproc     4096
root       soft    nproc     unlimited

sudo无需密码

编辑sudo配置文件

# sudo visudo
your_user_name ALL=(ALL) NOPASSWD: ALL

不起作用?

原因是被后面的group的设置覆盖了,需要把group的设置也改为nopasswd

%wheel  ALL=(ALL)       NOPASSWD: ALL

goose – golang database migration tool

goose是一个golang的数据库迁移工具

安装

go get bitbucket.org/liamstask/goose/cmd/goose

创建目录

mkdir db

初始化dbconf

# vim db/dbconf.yml
development:
    driver: mymysql
    open: dbname/username/password
    import: github.com/ziutek/mymysql/godrv
    dialect: mysql

新增迁移脚本

goose create init sql

升级

goose up

降级

goose down

重做

goose redo

状态

goose status

SQL迁移

-- +goose Up
CREATE TABLE post (
    id int NOT NULL,
    title text,
    body text,
    PRIMARY KEY(id)
);

-- +goose Down
DROP TABLE post;