Centos6.9安装MySQL8.0

开始搭自研项目的服务器环境,先装个MySQL,之前只在测试机上玩5.5版本,现在MySQL版本已出到8.0,号称性能提升不少,准备尝尝鲜,不知后面会有多少什么莫明问题等着解决。

继续阅读 →

pycharm 2018 永久破解

(1)下载破解补丁http://idea.lanyus.com/help/help.html

http://idea.lanyus.com/

破解补丁无需使用注册码,下载地址:http://idea.lanyus.com/jar/JetbrainsCrack-2.7-release-str.jar

(2)将最新的JetbrainsCrack-2.7-release-str.jar 拷贝到pycharm安装的目录bin下,例如:/home/user/tools/pycharm-2018.1.1/bin

(3)终端运行 sudo java -jar JetbrainsCrack-2.7-release-str.jar ,出现如下信息

***************************************************
*              Jetbrains Crack v2.7               *
*                                                 *
*  rover12421@163.com                             *
*  QQ Group: 126896013                            *
*  https://plus.google.com/117387751303563410161  *
*                                                 *
*                                    2018/02/02   *
*                                                 *
***************************************************

Usage:
1. Copy the jar file to bin directory.
2. Modify “bin/*[idea|clion|…][64].vmoptions” file.
Append “-javaagent:JetbrainsCrack.jar” to end line.
3. Run *[idea|clion|…].sh.
4. Entry any character.
5. If you need modify “licenseeName”, please modify and using key:
{“licenseId”:”ThisCrackLicenseId”,
“licenseeName”:”Rover12421″,
“assigneeName”:”Rover12421″,
“assigneeEmail”:”rover12421@163.com”,
“licenseRestriction”:”By Rover12421 Crack, Only Test! Please support genuine!!!”,
“checkConcurrentUse”:false,
“products”:[
{“code”:”II”,”paidUpTo”:”2099-12-31″},
{“code”:”DM”,”paidUpTo”:”2099-12-31″},
{“code”:”AC”,”paidUpTo”:”2099-12-31″},
{“code”:”RS0″,”paidUpTo”:”2099-12-31″},
{“code”:”WS”,”paidUpTo”:”2099-12-31″},
{“code”:”DPN”,”paidUpTo”:”2099-12-31″},
{“code”:”RC”,”paidUpTo”:”2099-12-31″},
{“code”:”PS”,”paidUpTo”:”2099-12-31″},
{“code”:”DC”,”paidUpTo”:”2099-12-31″},
{“code”:”RM”,”paidUpTo”:”2099-12-31″},
{“code”:”CL”,”paidUpTo”:”2099-12-31″},
{“code”:”PC”,”paidUpTo”:”2099-12-31″},
{“code”:”DB”,”paidUpTo”:”2099-12-31″},
{“code”:”GO”,”paidUpTo”:”2099-12-31″},
{“code”:”RD”,”paidUpTo”:”2099-12-31″}
],
“hash”:”2911276/0″,
“gracePeriodDays”:7,
“autoProlongated”:false}
6. If show error msg : “Error opening zip file or JAR manifest missing : JetbrainsCrack.jar”
please modify the jar file path to absolute path in “bin/*[idea|clion|…][64].vmoptions” file.

(4)bin文件夹下发现pycharm64.vmoptions,编辑,在最后一行加上JetbrainsCrack.jar的绝对路径,如下:

-javaagent:/home/user/tools/pycharm-2018.1.1/bin/JetbrainsCrack-2.7-release-str.jar 保存即可

(5)接下来运行pycharm.sh,终端输入:./pycharm.sh
出现需要激活的界面,选择中间激活码一栏,看到刚才提示的黄色字体中的code部分了吗?随便选择一个,比如我直接输入:”code”:”II”,”paidUpTo”:”2099-12-31″,然后点击确定即可激活!

RedMine安装总结

今天在测试笔记本上试装了redmine,准备用它做自研项目的管理软件,主要根据官方文档和另一篇文章来安装,途中也经历了一些 文章没记录的错误,经过一番摸索后安装成功,这里做个总结。

安装环境是Centos6.9,已安装Aphache,PHP,MySQL5.5.32,有需要的应该只有MySQL。

先在官网上下载了软件包:redmine-3.4.5.tar.gz

官网安装说明文档:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

因为机子上已有MySQL,这里就省略这部分安装,需要说明的是我的MySQL做了多实例,所以后面的Socket配置会和常规稍有不同。

设置mysql的账号[root@node1 mysql]# mysql  -uroot -p和密码,并创建redmine数据库

[root@node1 mysql]# mysql  -uroot -p
root@node1 14:18:  [(none)]> create database redmine character set utf8;
Query OK, 1 row affected (0.01 sec)
[root@node1 mysql]# mysql  -uroot -p
root@node1 14:29:  [(none)]> create user 'redmine'@'localhost' IDENTIFIED BY 'my_password';
Query OK, 0 rows affected (0.00 sec)
root@node1 14:29:  [(none)]> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
root@node1 14:30:  [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

安装rvm

curl -L get.rvm.io | bash -s stable

如果遇到以下报错,则执行报错中的gpg2 –recv-keys的命令

[root@node1 ~]# curl -L get.rvm.io | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    335      0 --:--:-- --:--:-- --:--:--   335
100 24090  100 24090    0     0  17421      0  0:00:01  0:00:01 --:--:-- 44446
Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc
gpg: 于 2017年09月11日 星期一 04时59分21秒 CST 创建的签名,使用 RSA,钥匙号 BF04FF17
gpg: 无法检查签名:没有公钥
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures 
when GPG software found. Assuming you trust Michal Papis import the mpapis public
 key (downloading the signatures).
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.3.tgz' '
https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc'! Try to 
install GPG v2 and then fetch the public key:
    gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3  # 报错执行这个命令
or if it fails:
    command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
the key can be compared with:
    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys 
from remote server. Please downgrade or upgrade to newer version (if available) 
or use the second method described above.
执行报错中的gpg2 –recv-keys的命令。
[root@node1 ~]# gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: 钥匙环‘/root/.gnupg/secring.gpg’已建立
gpg: 下载密钥‘D39DC0E3’,从 hkp 服务器 keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg:建立了信任度数据库
gpg: 密钥 D39DC0E3:公钥“Michal Papis (RVM signing) <mpapis@gmail.com>”已导入
gpg: 没有找到任何绝对信任的密钥
gpg: 合计被处理的数量:1
gpg:           已导入:1  (RSA: 1)
再次执行命令curl -L get.rvm.io | bash -s stable。
[root@node1 ~]# curl -L get.rvm.io | bash -s stable
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    310      0 --:--:-- --:--:-- --:--:--   309
100 24090  100 24090    0     0  18230      0  0:00:01  0:00:01 --:--:--  103k
Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc
gpg: 于 2017年09月11日 星期一 04时59分21秒 CST 创建的签名,使用 RSA,钥匙号 BF04FF17
gpg: 完好的签名,来自于“Michal Papis (RVM signing) <mpapis@gmail.com>”
gpg:               亦即“Michal Papis <michal.papis@toptal.com>”
gpg:               亦即“[jpeg image of size 5015]”
gpg: 警告:这把密钥未经受信任的签名认证!
gpg:       没有证据表明这个签名属于它所声称的持有者。
主钥指纹: 409B 6B17 96C2 7546 2A17  0311 3804 BB82 D39D C0E3
子钥指纹: 62C9 E5F4 DA30 0D94 AC36  166B E206 C29F BF04 FF17
GPG verified '/usr/local/rvm/archives/rvm-1.29.3.tgz'
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,    
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`    
in all your open shell windows, in rare cases you need to reopen all shell windows.
以上表示执行成功,然后加载一下rvm命令。
[root@node1 ~]# source /usr/local/rvm/scripts/rvm
查看rvm库中已知的ruby版本
[root@node1 ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head# security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head
... ...

安装Ruby

#安装ruby
[root@node1 ~]# rvm install  2.4.1
#使用新版本
[root@node1 ~]# rvm use  2.4.1
#查看当前版本
[root@node1 ~]# ruby --version
如果gem的源所在的网络不好,可以更改源
请尽可能用比较新的 RubyGems 版本,建议 2.6.x 以上。
[root@node1 ~]# gem update --system  # 这里请×××一下
[root@node1 ~]# gem -v
2.6.14
[root@node1 ~]# gem sources -l       # 查看当前镜像源 
https://rubygems.org/
[root@node1 ~]# gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
[root@node1 ~]# gem sources -l
https://gems.ruby-china.org
# 确保只有 gems.ruby-china.org
如果你使用 Gemfile 和 Bundler (例如:Rails 项目)
你可以用 Bundler 的 Gem 源代码镜像命令。
[root@node1 ~]# bundle config mirror.https://rubygems.org https://gems.ruby-china.org
这样你不用改你的 Gemfile 的 source。
source 'https://rubygems.org/'
gem 'rails''4.2.5'
...
SSL 证书错误
正常情况下,你是不会遇到 SSL 证书错误的,除非你的 Ruby 安装方式不正确。
如果遇到 SSL 证书问题,你又无法解决,请修改 ~/.gemrc 文件,增加 ssl_verify_mode: 0 配置,以便于 RubyGems 可以忽略 SSL 证书错误。
---
:sources:
- https://gems.ruby-china.org
:ssl_verify_mode: 0
如果你在意 Gem 下载的安全问题,请正确安装 Ruby、OpenSSL,建议部署 Linux 服务器的时候采用 这个 RVM 安装脚本 的方式安装 Ruby。

安装rails 和 相关依赖包

[root@node1 ~]# gem install rails  
[root@node1 ~]# gem install rake  
[root@node1 ~]# gem install mysql2

下载redmine并安装依赖

[root@node1 ~]# yum install ImageMagick-devel
[root@node1 ~]# useradd -s /sbin/nologin redmine
[root@node1 ~]# cd /usr/local/  
[root@node1 local]# wget http://www.redmine.org/releases/redmine-3.4.4.tar.gz
[root@node1 local]# tar xf redmine-3.4.4.tar.gz
[root@node1 local]# mv redmine-3.4.4 redmine && cd redmine 
[root@node1 local]# chown -R root:root /usr/local/redmine   
[root@node1 redmine]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and 
installing your bundle as root will break this application for all non-root 
users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms 
Bundler is installing for. Bundler is installing for ruby but the dependency 
is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to 
the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 12.3.1
... ...
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from yard:
--------------------------------------------------------------------------------
As of YARD v0.9.2:
RubyGems "--document=yri,yard" hooks are now supported. You can auto-configure
YARD to automatically build the yri index for installed gems by typing:
$ yard config --gem-install-yri
See `yard config --help` for more information on RubyGems install hooks.
You can also add the following to your .gemspec to have YARD document your gem
on install:
spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
--------------------------------------------------------

配置redmine并初始化

[root@node1 ~]# cd /usr/local/redmine/config/
[root@node1 config]# cp configuration.yml{.example,}
[root@node1 config]# cp database.yml{.example,}
[root@node1 config]# vim database.yml   #选择production部分修改数据库密码  
    production:
      adapter: mysql2
      database: redmine
      host: localhost
      port: 3306                            
      socket: /data/3306/mysql.sock
      username: redmine
      password: "my_password"
      encoding:utf8mb4 //这里应填utf8
[root@node1 config]# cd ../
[root@node1 redmine]# rake generate_secret_token  
[root@node1 redmine]# RAILS_ENV=production bundle exec rake db:migrate    #生成表结构 
    == 1 Setup: migrating =========================================================
    -- create_table("attachments", {:force=>true})
       -> 0.0363s
    -- create_table("auth_sources", {:force=>true})
       -> 0.0231s
    ... ...
    == 20170419144536 AddViewMessagesToAllExistingRoles: migrating ================
    == 20170419144536 AddViewMessagesToAllExistingRoles: migrated (0.0170s) =======
[root@node1 redmine]# RAILS_ENV=production bundle exec rake redmine:load_default_data
# 初始化数据选择zh 
    Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et,
    eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, 
    pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
    ====================================
    Default configuration data loaded.
[root@node1 redmine]#
在此步骤报了个错:
Error: unknown attribute ‘issues_visibility’ for Role.
我做了如下处理后得到解决:
1.把数据库中redmine库的字符集从原来设置的utf8mb4改为utf8;
2.把redmine库里自动生成的表全部清空,重新生成。这里用了个批理删除方法:
SELECT CONCAT(‘TRUNCATE TABLE ‘,TABLE_NAME,’;’) FROM information_schema.TABLES WHERE TABLE_SCHEMA=’test’ into outfile ‘/tmp/truncate_test.sql’;
source  /tmp/truncate_test.sql
3.再运行上面命令重新初始化redmine库。
RAILS_ENV=production bundle exec rake db:migrate    #生成表结构
RAILS_ENV=production bundle exec rake redmine:load_default_data       # 初始化数据选择zh
这次成功执行。
权限设置:
[root@node1 redmine]# pwd
/usr/local/redmine
[root@node1 redmine]# mkdir -pv  tmp tmp/pdf public/plugin_assets
[root@node1 redmine]# chown -R redmine:redmine files log tmp public/plugin_assets
[root@node1 redmine]# chmod -R 755 files log tmp public/plugin_assets

启动redmine

[root@node1 ~]#/usr/local/redmine/bin/rails server -e production -b 192.168.1.10

访问登录

访问 http://ip:3000/
默认账号和密码 admin admin

后续备份:

主要是备份mysql的redmine库,config下面的yml配置文件,以及files下面的附件:
#!/bin/bash
bk_time=`date +"%Y%m%d"`
cd /usr/local/redmine
tar -zcf /home/redmine/redmine_backup/conf_file_${bk_time}.tar.gz files/ config/*.yml
mysqldump -u**** -p"****" redmine |gzip /home/redmine/mysql_backup/redmine_${bk_time}.sql.gz