Category Archives: linux应用

nginx编译参数记录

 

lua和geoip

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --add-dynamic-module=/data/nginx/ngx_http_geoip2_module --add-dynamic-module=/data/nginx/echo-nginx-module --add-dynamic-module=/data/nginx/lua-nginx-module

passenger

passenger-config --nginx-addon-dir  用这个命令获得路径

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-ipv6 --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --add-dynamic-module=path

centos7 iptables 导出 备份 导入

1、备份iptables规则

iptables-save命令用来批量导出iptables防火墙规则,直接执行iptables-save时,将显示出当前启用的所有规则,按照raw、mangle、nat、filter表的顺序依次列出;若只希望显示出某一个表,应添加“-t表名”作为命令选项,然后结合重定向输入“>”将输出内容重定向到某个文件中。

列如:备份所有表的规则,操作如下:

[root@localhost /]#iptables-save >/root/iptables-save

 

后者默认将所有规则保存到“/etc/sysconfig/iptables”文件中。

2、恢复iptables规则

iptables-retore命令用来批量导入Linux防火墙规则,如果已经有使用iptable-save命令导出的备份文件,则恢复规则的过程也就是一瞬间的事。与iptables-save命令相对的,iptables-restore命令应结合重定向输入来指定备份文件的位置。

列如:将上所备份的规则恢复到iptables中,操作如下:

[root@localhost /]#iptables-restore < /root/iptables-save

切换JAVA版本 cenots 7

update-alternatives --config java

 

update-alternatives --config javac

centos7 安装 docker

 

  • 添加docker源。
     cat >/etc/yum.repos.d/docker.repo <<-EOF
    [dockerrepo]
    name=Docker Repository
    baseurl=https://yum.dockerproject.org/repo/main/centos/7 
    enabled=1 
    gpgcheck=1 
    gpgkey=https://yum.dockerproject.org/gpg 
    EOF
  • 使用yum命令安装docker。
    $ sudo yum install docker-engine 

 

  • 启动docker服务。
    $ sudo service docker start

下载 ubuntu trusty

$ docker pull ubuntu:trusty

 

以交互命令运行

$ docker run -i -t library/ubuntu:trusty /bin/bash

先UPDATE一下

安装SSH终端服务器,便于我们外部使用SSH客户端登陆访问

[root@b5926410fe60 /]# yum install passwd openssl openssh-server -y

启动sshd:
# /usr/sbin/sshd -D
这时报以下错误:
[root@ b5926410fe60 /]# /usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key 


执行以下命令解决:
[root@b5926410fe60 /]# ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ''    
[root@b5926410fe60 /]#  ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
[root@b5926410fe60 /]# ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key  -N '' 

yum install passwd
passwd


 

获取到刚才操作的实例容器ID

#docker ps -l
CONTAINER ID        IMAGE                   COMMAND             CREATED             STATUS                      PORTS               NAMES
fceac2533703        library/ubuntu:trusty   "/bin/bash"         24 minutes ago      Exited (0) 36 seconds ago                       adoring_murdock

以后台进程方式长期运行此镜像实例:

docker run -d -p 22 -p 2333:2333  learn/tutorial /usr/sbin/sshd -D

 

 

 

 

 

 

 

 

gitlab ecplise 使用 startssl 证书时 无法使用HTTPS连接的解决办法 向JVM导入证书

管理员运行cmd

cd C:\Program Files\Java\jre7\lib\security

keytool -keystore cacerts -importcert -alias startcom.ca  -file ca.crt
keytool -keystore cacerts -importcert -alias startcom.ca.sub  -file sub.class1.server.ca.crt
keytool -keystore cacerts -importcert -alias startcom.cabundle.crt  -file ca-bundle.crt

security-jvm  左边是startcom 各种证书下载包解压到C:\Program Files\Java\jre7\lib\security

multicraft 配置 smtp 发信 multicraft configure send email with smtp

multicraft默认使用的php函数发信,被很多邮件商当作垃圾信件给处理掉了。

Because default send mail method of  multicraft is php mail (),So our confirm and restpassword email always be treated as junk mail by the most of email services.

所以我们亟需配置一下SMTP发现。

So our immediate requirement is change our send mail method from PHP to SMTP.

首先你得有一个邮箱,QQ,网易,新浪啥的都行。记得开启SMTP功能!

Firstly you need a email :D,such like Google or any other else.Remember open the SMTP!

然后来到面板/protected/config/internal/application.php 编辑打开大约在第138行

that go to ~panel~/protected/config/internal/application.php and edit about at line 138.

'mail'=>array(
            'class'=>'ext.yii-mail.YiiMail',
            'logging'=>false,
                        'transportType'=>'php',

改成

        'mail'=>array(
            'class'=>'ext.yii-mail.YiiMail',
            'logging'=>true,
                        'transportType'=>'smtp',
                'transportOptions'=>array(
                'host'=>'smtp.qq.com',
                'username'=>'minet@mqq.com',
                'password'=>'qqqqq',
                'port'=>465,
                'encryption'=>'tls',
        ),

然后好像是PHP版本大于等于5.5的话

Some guys and me me a problem.if you php version is higher than 5.4

会显示

the rest password page would be shown:

Undefined property: Swift_Transport_StreamBuffer::$_sequence

那你就在

面板//protected/extensions/yii-mail/vendors/swiftMailer/classes/Swift/Transport/StreamBuffer.php中大约第163行

So you go to panel~/protected/extensions/yii-mail/vendors/swiftMailer/classes/Swift/Transport/StreamBuffer.php

about at line 163

  public function readLine($sequence)
  {
    if (isset($this->_out) && !feof($this->_out))
    {
      $line = fgets($this->_out);
      return $line;
    }
  }
  private $_sequence;  //(加入这条)(insertraline)

If you feel this is helpful to you please leave a comment.thank~

看贴不回贴,立马就怀孕!

在 centos7上安装 gitlab8 源码安装 配置 备份

0.添加一些必要的YUM源

EPEL啊 mariaDB啊 remi这些的

还要有RUBY版本管理器RVM

1. 依赖项

执行下面的几条命令

# run as root!
yum -y update
yum -y groupinstall 'Development Tools'
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-Time-HiRes

然后把VIM作为默认的editor

# Install vim and set as default editor
yum install -y vim
sudo update-alternatives --set editor /usr/bin/vim.basic

再装一些编译用的

yum install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake nodejs

唔帮徒的看一下下面的

If you want to use Kerberos for user authentication, then install libkrb5-dev:

yum install libkrb5-dev

Note: If you don't know what Kerberos is, you can assume you don't need it.

centos7的git模板版本就够(泪啊,centos的默认包终于还算行了)

# Install Git
yum install -y git

# Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 2.0.0
git --version

gitlab用postfix发email的

yum install -y postfix

Then select 'Internet Site' and press enter to confirm the hostname.

2. Ruby

安装ruby

yum install ruby 

yum install ruby-devel

接着安装 Bundler Gem:

sudo gem install bundler --no-ri --no-rdoc
(如果报错请看本站的添加RUBY源)

gem install rdoc-data; rdoc-data --install

 

3. Go

安装GO

yum install go 

4. System Users

添加GITLAB用户

adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git

Important : Important: In order to include /usr/local/bin to git user's PATH, one way is to edit the sudoers file. As root run:

配置一下环境变量

1
2
3
4
5
6
7
8
# type an enter :
visudo
#search for the line and and append <b>/usr/local/bin</b> like so:
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
#like this ----->
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

save and exit

5. Database

数据库支持两种,1种mysql,1种postgresql

按以下步骤执行
# I安装
yum install -y postgresql postgresql-client postgresql-devel

# 登陆
sudo -u postgres psql -d template1

# 创建用户
# Do not type the 'template1=#', this is part of the prompt
template1=# CREATE USER git CREATEDB;

# 授权
template1=# CREATE DATABASE gitlabhq_production OWNER git;

# 退出
template1=# \q

# 测试
sudo -u git -H psql -d gitlabhq_production

# 退出
gitlabhq_production> \q
# 安装
yum install -y mysql-server mysql-client lmysql-devel

# Ensure you have MySQL version 5.5.14 or later
mysql --version
systemctl enable mysql
systemctl start mysql

# 初始化
sudo mysql_secure_installation

# 登陆
mysql -u root -p

# Type the MySQL root password

# 创建用户
# do not type the 'mysql>', this is part of the prompt
# change $password in the command below to a real password you pick
mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';

# 选择储存引擎
# If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf`, `/etc/mysql/conf.d/*`) for the setting "innodb = off"
mysql> SET storage_engine=INNODB;

# 创建数据库
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;

# 授权
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost';

# 退出
mysql> \q

# 测试
sudo -u git -H mysql -u git -p -D gitlabhq_production

# Type the password you replaced $password with earlier

# 查看权限
'mysql>' prompt

# 退出
mysql> \q

# You are done installing the database and can go back to the rest of the installation.

6. Redis

安装REDIS

Make sure redis is started on boot:

chkconfig redis on

配置接口

Configure redis to use sockets:

cp /etc/redis.conf /etc/redis.conf.orig

进制REDIS监听TCP端口,防止黑客

Disable Redis listening on TCP by setting 'port' to 0:

sed 's/^port .*/port 0/' /etc/redis.conf.orig |  tee /etc/redis.conf

Enable Redis socket for default CentOS path:

echo 'unixsocket /run/redis/redis.sock' | tee -a /etc/redis.conf
echo -e 'unixsocketperm 0770' | tee -a /etc/redis.conf

Create the directory which contains the socket

mkdir /var/run/redis
chown redis:redis /var/run/redis
chmod 755 /var/run/redis

导入接口

if [ -d /etc/tmpfiles.d ]; then
    echo 'd  /run/redis  0755  redis  redis  10d  -' |  tee -a /etc/tmpfiles.d/redis.conf
fi

重启生效一下

service redis restart
# 添加 git 进 redis 组
 usermod -aG redis git

7. GitLab

开始弄GIT啦

# 创建文件夹(如果没有的话)
cd /home/git

下载源代码(此处可以用screen)

# Clone GitLab repository
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 8-0-stable gitlab

Note: You can change 8-0-stable to master if you want the bleeding edge version, but never install master on a production server!

你可以把stable换成master,但是在生产环境下不推荐这么做

----

配置

# Go to GitLab installation folder
cd /home/git/gitlab

# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

# Update GitLab config file, follow the directions at top of file
sudo -u git -H editor config/gitlab.yml

# Copy the example secrets file
sudo -u git -H cp config/secrets.yml.example config/secrets.yml
sudo -u git -H chmod 0600 config/secrets.yml

# Make sure GitLab can write to the log/ and tmp/ directories
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/

# Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/

# Make sure GitLab can write to the public/uploads/ directory
sudo chmod -R u+rwX  public/uploads

# Change the permissions of the directory where CI build traces are stored
sudo chmod -R u+rwX builds/

# Copy the example Unicorn config
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb

# Find number of cores
nproc

# Enable cluster mode if you expect to have a high load instance
# Ex. change amount of workers to 3 for 2GB RAM server
# Set the number of workers to at least the number of cores
sudo -u git -H editor config/unicorn.rb

# Copy the example Rack attack config
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

# Configure Git global settings for git user, used when editing via web editor
sudo -u git -H git config --global core.autocrlf input

# Configure Redis connection settings
sudo -u git -H cp config/resque.yml.example config/resque.yml

# Change the Redis socket path if you are not using the default Debian / Ubuntu configuration
sudo -u git -H editor config/resque.yml

Important Note: Make sure to edit both gitlab.yml and unicorn.rb to match your setup.

一定要确认gitlab.yml和unicorn.rb是适合你的服务器的。

Note: If you want to use HTTPS, see Using HTTPS for the additional steps.

如果你想配置HTTPS请点上面那个HTTPS的超链接

配置GITLAB和数据库

# 用postgresql数据库的看这里
#PostgreSQL only:
sudo -u git cp config/database.yml.postgresql config/database.yml

# MySQL only:用Mysql mariadb的看这里
sudo -u git cp config/database.yml.mysql config/database.yml

# MySQL and remote PostgreSQL only:数据库不在本机的看这里
# Update username/password in config/database.yml.
# You only need to adapt the production settings (first part).
# If you followed the database guide then please do as follows:
# Change 'secure password' with the value you have given to $password
# You can keep the double quotes around the password
sudo -u git -H editor config/database.yml

# PostgreSQL and MySQL:
# Make config/database.yml readable to git only
sudo -u git -H chmod o-rwx config/database.yml

安装GEM

Note: As of bundler 1.5.2, you can invoke bundle install -jN (where N the number of your processor cores) and enjoy the parallel gems installation with measurable difference in completion time (~60% faster). Check the number of your cores with nproc. For more information check this post. First make sure you have bundler >= 1.5.2 (run bundle -v) as it addresses some issues that were fixed in 1.5.2.

# For PostgreSQL (note, the option says "without ... mysql")装postgresql的看这里
sudo -u git -H bundle install --deployment --without development test mysql aws kerberos

# Or if you use MySQL (note, the option says "without ... postgres")装MYSQL的看这里
sudo -u git -H bundle install --deployment --without development test postgres aws kerberos

Note: If you want to use Kerberos for user authentication, then omit kerberos in the --without option above.

安装GitLab Shell

GitLab Shell is an SSH access and repository management software developed specially for GitLab.

# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
sudo -u git -H bundle exec rake gitlab:shell:install[v2.6.5] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production

# By default, the gitlab-shell config is generated from your main GitLab config.
# You can review (and modify) the gitlab-shell config as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml

Note: If you want to use HTTPS, see Using HTTPS for the additional steps.

Note: Make sure your hostname can be resolved on the machine itself by either a proper DNS record or an additional line in /etc/hosts ("127.0.0.1 hostname"). This might be necessary for example if you set up gitlab behind a reverse proxy. If the hostname cannot be resolved, the final installation check will fail with "Check GitLab API access: FAILED. code: 401" and pushing commits will be rejected with "[remote rejected] master -> master (hook declined)".

安装gitlab http server

cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-git-http-server.git
cd gitlab-git-http-server
sudo -u git -H make

初始化数据库和激活高级特性

cd /home/git/gitlab/

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

# Type 'yes' to create the database tables.

# When done you see 'Administrator account created:'

Note: You can set the Administrator/root password by supplying it in environmental variable GITLAB_ROOT_PASSWORD as seen below. If you don't set the password (and it is set to the default one) please wait with exposing GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login you'll be forced to change the default password.

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword

保护密码

Secure secrets.yml

The secrets.yml file stores encryption keys for sessions and secure variables. Backup secrets.yml someplace safe, but don't store it in the same place as your database backups. Otherwise your secrets are exposed if one of your backups is compromised.

安装计划表

Install schedules

# Setup schedules
sudo -u gitlab_ci -H bundle exec whenever -w RAILS_ENV=production

安装初始化脚本

Install Init Script

Download the init script (will be /etc/init.d/gitlab):

sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab

And if you are installing with a non-default folder or user copy and edit the defaults file:

sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab

If you installed GitLab in another directory or as a user other than the default you should change these settings in /etc/default/gitlab. Do not edit/etc/init.d/gitlab as it will be changed on upgrade.

Make GitLab start on boot:

sudo update-rc.d gitlab defaults 21

安装 Logrotate

sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

检查应用状态

Check if GitLab and its environment are configured correctly:

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

编译

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

启动GITLAB

sudo service gitlab start
# or
sudo /etc/init.d/gitlab restart

9. apache

Note: Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the GitLab recipes.

安装

yum install httpd

站点配置

Copy the example site config:

cd /etc/httpd/conf
wget https://gitlab.com/gitlab-org/gitlab-recipes/blob/8cee2936371f6d597990adc19f02f03338a8b8ed/web-server/apache/gitlab-8.0-apache2.4.conf

编辑一下httpd.conf

把这个vhost conf添加进去

vi http.conf

重启Apache

systemctl restart httpd

至此就完成了

再检测一下安装是否正确

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

初始化登陆

root
5iveL!fe

Important Note: On login you'll be prompted to change the password.

愉悦~!

Custom SSH Connection

If you are running SSH on a non-standard port, you must change the GitLab user's SSH config.

# Add to /home/git/.ssh/config
host localhost          # Give your setup a name (here: override localhost)
    user git            # Your remote git user
    port 2222           # Your port number
    hostname 127.0.0.1; # Your server name or IP

You also need to change the corresponding options (e.g. ssh_user, ssh_host, admin_uri) in the config\gitlab.yml file.

设置QQ邮箱发件GitLab SMTP

sudo mv /home/git/gitlab/config/initializers/smtp_settings.rb.example /home/git/gitlab/config/initializers/smtp_settings.rb 
$ sudo vim /home/git/gitlab/config/initializers/smtp_settings.rb 
# To enable smtp email delivery for your GitLab instance do the following: 
# 1. Rename this file to smtp_settings.rb 
# 2. Edit settings inside this file 
# 3. Restart GitLab instance # 
# For full list of options and their values see http://api.rubyonrails.org/classes/ActionMailer/Base.html #
 # If you change this file in a Merge Request, please also create a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests 
if Rails.env.production? Gitlab::Application.config.action_mailer.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
address: "smtp.qq.com", 
port: 25, 
user_name: "username@domainname", //
QQ企业邮箱账号 password: "password", 
domain: "smtp.qq.com", 
authentication: :plain, 
enable_starttls_auto: false, 
openssl_verify_mode: 'none' # See ActionMailer documentation for other possible options
} 
end 
$ sudo /home/git/gitlab/config/environments/production.rb 
... 
config.action_mailer.delivery_method = :smtp //这里修改为:smtp 
# Defaults to: 
# # config.action_mailer.sendmail_settings = { 
# # location: '/usr/sbin/sendmail', 
# # arguments: '-i -t' 
# # } ... 
$ sudo service gitlab restart && sudo service apache restart

Additional Markup Styles

Apart from the always supported markdown style there are other rich text files that GitLab can display. But you might have to install a dependency to do so. Please see the github-markup gem readme for more information.

Troubleshooting

如果使用的是apache但是提示NGINX错误什么的话,执行

bundle exec unicorn_rails -c config/unicorn.rb -E production -D

"You appear to have cloned an empty repository."

If you see this message when attempting to clone a repository hosted by GitLab, this is likely due to an outdated Nginx or Apache configuration, or a missing or misconfigured gitlab-git-http-server instance. Double-check that you've installed Go, installed gitlab-git-http-server, and correctly configured Nginx.

备份

# if you've installed GitLab from source
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

 

在centos7上安装odoo9 服务器配置 install odoo9 with centos7

如果不会处理mariadb和PostgreSQL的话,就先吧mariadb删了(一般也不用 卸载)

yum remove mariadb mariadb-server

清理一下RPM包

yum clean all
yum update

安装PostgreSQL 和 PHP-PostgreSQL 的扩展

yum install postgresql-libs postgresql-server postgresql php-pgsql php-gd
yum install php*

安装大蟒蛇和扩展

yum install babel python-devel libxslt-python pyparsing python-dateutil python-decorator python-imaging python-jinja2 python-ldap python-lxml python-mako python-psycopg2 python-reportlab python-requests python-werkzeug python-yaml python-docutils  python-matplotlib python-unittest2.noarch python-babel python-gevent pygtk2 glade3 pytz libxslt-devel bzr automake gcc gcc-c++ byacc kernel-headers python-passlib

yum install pychart nodejs-less python-feedparser python-mock python-openid python-psutil python-vobject

安装JS(如果报错,没关系,执行下面的命令)

yum install nodejs*(如果报错,执行下面的命令)
yum install nodejes-less nodejs-clean-css

重启一下APACHE

systemctl restart httpd.service

初始化 PostgreSQL database cluster:

postgresql-setup initdb

让PostgreSQL跟随系统启动

systemctl enable postgresql.service

启动PostgreSQL service 给 ‘postgres’ 用户设置密码

systemctl start postgresql.service
su - postgres
psql
\password postgres
(Enter new password twice)
\q
exit

创建系统用户 ‘odoo’:(ssh可以配置只能用证书登录)

adduser odoo
passwd odoo

创建PostgreSQL用户“odoo”

su - postgres -c "createuser --pwprompt --createdb --no-createrole --no-superuser odoo"
(Enter new 'odoo' user password twice)

下载RPM包并安装

cd /opt 
wget http://nightly.odoo.com/9.0/nightly/rpm/odoo_9.0.latest.noarch.rpm
rpm -ivh odoo_9.0.latest.noarch.rpm

如果有问题的话,无法连接 pydot.googlecode.com或者什么GOOGLE之类的

就在/etc/hosts加入103.7.200.79    pydot.googlecode.com(这个IP暂时可以用你缺什么就直接加入xxx.gogglexsad(之类的).com)

给ODOO用户openerp文件夹的权限

chown odoo -R /usr/lib/python2.7/site-packages/openerp/

执行下面两个步骤

export LD_LIBRARY_PATH; LD_LIBRARY_PATH=/usr/local/lib
source ~odoo/.bashrc

编辑一下postgresql的本地访问权限 ‘/var/lib/pgsql/data/pg_hba.conf’

vi /var/lib/pgsql/data/pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust # changed from 'peer'
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust # changed from 'ident'
# IPv6 local connections:
host    all             all             ::1/128                 trust # changed from 'ident'

检查一下是否成功

su - postgres
psql
postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges
-----------+----------+-----------+---------+-------+-----------------------
 postgres  | postgres | SQL_ASCII | C       | C     |
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres

以UTF8编码, 运行下面这几条命令

update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';
\q

编辑一下/etc/odoo/openerp-server.conf(一般也不用编辑)

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/openerp/addons

proxy_mode = True(需要APACHE做转发的开启)

重启一下postgreSQL服务

systemctl restart postgresql.service

设置开机启动

systemctl enable odoo

启动

systemctl start odoo

现在访问你的http://ip:8069试试吧!

httpd conf

<VirtualHost 115.28.221.102:80>
ServerName finance.memotz.com
ServerAlias finance.memotz.com // Use this if you want dbfillter on subdomain
ErrorLog /var/log/httpd/openerp-error.log
CustomLog /var/log/httpd/openerp-access.log combined
ProxyRequests Off
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
ProxyVia On
LogLevel warn
</VirtualHost>

openvz 修改 时区 centos

rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

date -R

将当前时间和日期写入BIOS,避免重启后失效

命令 : "hwclock -w"