源码安装gitlab
- 限制执行预定义好的Git命令(git push, git pull, git annex)
- 调用GitLab Rails API 检查权限
- 执行pre-receive钩子(在GitLab企业版中叫做Git钩子)
- 执行你请求的动作
- 处理GitLab的post-receive动作
- 处理自定义的post-receive动作
- 调用GitLab Rails API 检查权限
- 执行pre-receive钩子(在GitLab企业版中叫做Git钩子)
- 执行你请求的动作
- 处理GitLab的post-receive动作
- 处理自定义的post-receive动作
yum -y update
yum -y install gcc autoconf cmake unzip vim libcurl-devel zlib-devel curl-devel expat-devel gettext-devel openssl-devel perl-devel nodejs libicu-devel wget curl
wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz [root@t1 ~]# tar xf git-2.9.0.tar.gz
[root@t1 ~]# cd git-2.9.0
[root@t1 git-2.9.0]# ./configure
[root@t1 git-2.9.0]# make prefix=/usr/local all
# 安装到/usr/local/bin
[root@t1 git-2.9.0]# make prefix=/usr/local install
[root@t1 git-2.9.0]# source /etc/profile
# 验证git版本号
[root@t1 git-2.9.0]# git --version
#查看git安装路径
[root@t1 git-2.9.0]# which git
[root@t1 ~]# useradd -c 'Gitlab' -s /bin/bash git
#为了包含/usr/local/bin到git用户的$PATH,一个方法是编辑超级用户文件。以管理员身份运行:
$ visudo #然后搜索:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
#将其改成:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
#3.安装postfix
yum -y install postfix
#4. Ruby
#Note: The current supported Ruby version is 2.1.x. Ruby 2.2 and 2.3 are currently not supported. [root@t1 ~]# yum -y remove ruby* [root@t1 ~]# curl -O --progress https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz
[root@t1 ~]# tar xf ruby-2.1.8.tar.gz
[root@t1 ~]# cd ruby-2.1.8
[root@t1 ~]# ./configure --disable-install-rdoc
[root@t1 ~]# make
[root@t1 ~]# make install #Install the Bundler Gem:
[root@t1 ~]# sudo gem install bundler --no-ri --no-rdoc
#5. Go
#Since GitLab 8.0, Git HTTP requests are handled by gitlab-workhorse (formerly gitlab-git-http-server). This is a small daemon written in Go. To install gitlab-workhorse we need a Go compiler. The instructions below assume you use 64-bit Linux. You can find downloads for other platforms at the Go download page. [root@t1 ~]# curl -O --progress https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz
[root@t1 ~]# tar -C /usr/local -xzf go1.5.3.linux-amd64.tar.gz
[root@t1 ~]# ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/
[root@t1 ~]# rm go1.5.3.linux-amd64.tar.gz
修改数据库
#创建数据库,用户,添加权限
MariaDB [(none)]> CREATE USER 'git'@'localhost' IDENTIFIED BY 'gitlab';
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, REFERENCES ON `gitlabhq_production`.* TO 'git'@'localhost';
#安装Redis
yum install redis -y
cp /etc/redis.conf /etc/redis.conf.orig
#sed 's/^port .*/port 0/' /etc/redis.conf.orig |tee /etc/redis.conf #不需要执行
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis.conf
echo 'unixsocketperm 770' | sudo tee -a /etc/redis.conf
mkdir /var/run/redis
chown redis:redis /var/run/redis
chmod 755 /var/run/redis # Persist the directory which contains the socket, if applicable
if [ -d /etc/tmpfiles.d ]; then
echo 'd /var/run/redis 0755 redis redis 10d -' | sudo tee -a /etc/tmpfiles.d/redis.conf
fi systemctl start redis
chkconfig redis on
usermod -aG redis git
#7. GitLab
# We'll install GitLab into home directory of the user "git"
cd /home/git #Clone the Source
# Clone GitLab repository
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 8-9-stable gitlab #注意gitlab的版本 #Configure It
# 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 vim config/gitlab.yml gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: gitlabtest.ptmind.com
port: 443 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: true # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details bin_path: /usr/local/bin/git # Copy the example secrets file #注意:如果将备份文件在异地恢复,需要将老版的secrets.yml拷贝到新版的对应目录下
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/ # Create the public/uploads/ directory
sudo -u git -H mkdir public/uploads/ # Make sure only the GitLab user has access to the public/uploads/ directory
# now that files in public/uploads are served by gitlab-workhorse
sudo chmod 0700 public/uploads # Change the permissions of the directory where CI build traces are stored
sudo chmod -R u+rwX builds/ # Change the permissions of the directory where CI artifacts are stored
sudo chmod -R u+rwX shared/artifacts/ # 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
# Set the number of workers to at least the number of cores
# Ex. change amount of workers to 3 for 2GB RAM server
sudo -u git -H vim config/unicorn.rb
worker_processes 10
listen "127.0.0.1:8030", :tcp_nopush => true # 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
# 'autocrlf' is needed for the web editor
sudo -u git -H git config --global core.autocrlf input # Disable 'git gc --auto' because GitLab already runs 'git gc' when needed
sudo -u git -H git config --global gc.auto 0 # 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
# 修改Redis访问路径
sudo -u git -H vim config/resque.yml #Important Note: Make sure to edit both gitlab.yml and unicorn.rb to match your setup.
#Note: If you want to use HTTPS, see Using HTTPS for the additional steps. ##Configure GitLab DB Settings
# MySQL only:
sudo -u git cp config/database.yml.mysql config/database.yml # Change 'secure password' with the value you have given to $password
# You can keep the double quotes around the password
sudo -u git -H vim config/database.yml # MySQL:
# Make config/database.yml readable to git only
sudo -u git -H chmod o-rwx config/database.yml
cd /home/git/gitlab # For users from China mainland only
# 仅限中国大陆用户
# vim /home/git/gitlab/Gemfile
# source "https://ruby.taobao.org" // 原始 source "https://rubygems.org/" # For MySQL (note, the option says "without ... postgres") #修改ruby路径
vim /usr/local/bin/bundle
#!/usr/local/bin/ruby # Or if you use MySQL (note, the option says "without ... postgres")
sudo -u git -H bundle install -j5 --deployment --without development test postgres aws 报错:
Installing org-ruby 0.9.12
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
-----
libmysqlclient is missing. Trying again with extra runtime libraries...
----- 解决:
yum -y install mysql-devel Install 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): #如果redis在本地,可使用如下方式
sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production #如果redis在其他服务器,可使用如下方式:
sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=redis://172.16.5.101:6379 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 vim /home/git/gitlab-shell/config.yml
---
user: git
gitlab_url: http://127.0.0.1:8030/ ######注意修改端口,修改主机名,并在hosts中添加解析!!!!
http_settings:
self_signed_cert: false
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
bin: "/bin/redis-cli"
namespace: resque:gitlab
socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false
Install gitlab-workhorse
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
cd gitlab-workhorse
sudo -u git -H git checkout v0.7.5
sudo -u git -H make 配置repositories
因为修改了repositories路径,因此使用下面的/data/repositories/
sudo chmod -R ug+rwX,o-rwx /home/git/repositories/
sudo chmod -R ug-s /home/git/repositories/
sudo find /home/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s sudo chmod -R ug+rwX,o-rwx /data/git/repositories/
sudo chmod -R ug-s /data/git/repositories/
sudo find /data/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s Initialize Database and Activate Advanced Features
# Go to GitLab installation folder cd /home/git/gitlab #sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail # Type 'yes' to create the database tables. # When done you see 'Administrator account created:' #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. ls /home/git/gitlab/config/secrets.yml # Install Init Script
# Download the init script (will be /etc/init.d/gitlab): sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab # 修改workhorse访问gitlab-shell端口
vim /etc/init.d/gitlab
gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8030 -authSocket $rails_socket -documentRoot $app_root/public" #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 # 修改workhorse访问gitlab-shell端口
vim /etc/default/gitlab
gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8030 -authSocket $rails_socket -documentRoot $app_root/public"
chkconfig gitlab on
#Setup Logrotate
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
#Check Application Status
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
Compile Assets 编译静态文件
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
# Start Your GitLab Instance
sudo service gitlab start
yum -y install nginx sudo cp lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab.conf vim /etc/nginx/conf.d/gitlab.conf
## GitLab ## See installation.md#using-https for additional HTTPS configuration details. upstream gitlab-workhorse {
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
} ## Normal HTTP host
server {
## Either remove "default_server" from the listen line below,
## or delete the /etc/nginx/sites-enabled/default file. This will cause gitlab
## to be served if you visit any address that your server responds to, eg.
## the ip address of the server (http://x.x.x.x/)n 0.0.0.0:80 default_server;
# listen 0.0.0.0:80 default_server;
# listen [::]:80 default_server;
listen 80;
server_name gitlabtest.ptmind.com; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice ## See app/controllers/application_controller.rb for headers set ## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log; location / {
client_max_body_size 0;
gzip off; ## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off; proxy_http_version 1.1; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://gitlab-workhorse;
} error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
root /home/git/gitlab/public;
internal;
} } ################Nginx ssl 配置文件####################
upstream gitlab-workhorse {
server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
}
server {
listen 0.0.0.0:80;
server_name gitlab.ptengine.jp; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
return 301 https://$http_host$request_uri;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
}
server {
listen 0.0.0.0:443 ssl;
server_name gitlab.ptengine.jp; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
ssl on;
ssl_certificate /usr/local/nginx/ssl/www.ptengine.jp.pem;
ssl_certificate_key /usr/local/nginx/ssl/www.ptengine.jp.key;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
client_max_body_size 0;
gzip off;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-workhorse;
}
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
root /home/git/gitlab/public;
internal;
}
}
##############################################################
# 修改/home/git权限
chmod 755 /home/git
# 检查安装
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
# 备份:
##修改默认的备份目录
vim /home/git/gitlab/config/gitlab.yml
backup:
path: "/data/git/gitlab-backup/" mkdir -p /data/git/gitlab-backup/
chown -R git.git /data/git/gitlab-backup/ #重启 gitlab
service gitlab restart #执行备份
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
[root@nexus-5-101 gitlab]# sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
Dumping database ...
Dumping MySQL database gitlabhq_production ... mysqldump: Got error: 1045: "Access denied for user 'git'@'172.16.3.65' (using password: YES)" when trying to connect
[FAILED]
Backup failed vim /home/git/gitlab/lib/backup/database.rb
#第23行,将关于mysql的ENV['MYSQL_PWD']注销
#第75行,mysql_args下面添加'password' => '--password',
#########################################################################
vim /home/git/gitlab/lib/backup/database.rb require 'yaml' module Backup
class Database
attr_reader :config, :db_file_name def initialize
@config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
@db_file_name = File.join(Gitlab.config.backup.path, 'db', 'database.sql.gz')
end def dump
FileUtils.mkdir_p(File.dirname(db_file_name))
FileUtils.rm_f(db_file_name)
compress_rd, compress_wr = IO.pipe
compress_pid = spawn(*%W(gzip -1 -c), in: compress_rd, out: [db_file_name, 'w', 0600])
compress_rd.close dump_pid = case config["adapter"]
when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
# ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysqldump', *mysql_args, config['database'], out: compress_wr)
when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... "
pg_env
pgsql_args = ["--clean"] # Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
if Gitlab.config.backup.pg_schema
pgsql_args << "-n"
pgsql_args << Gitlab.config.backup.pg_schema
end
spawn('pg_dump', *pgsql_args, config['database'], out: compress_wr)
end
compress_wr.close success = [compress_pid, dump_pid].all? { |pid| Process.waitpid(pid); $?.success? } report_success(success)
abort 'Backup failed' unless success
end def restore
decompress_rd, decompress_wr = IO.pipe
decompress_pid = spawn(*%W(gzip -cd), out: decompress_wr, in: db_file_name)
decompress_wr.close restore_pid = case config["adapter"]
when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysql', *mysql_args, config['database'], in: decompress_rd)
when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... "
pg_env
spawn('psql', config['database'], in: decompress_rd)
end
decompress_rd.close success = [decompress_pid, restore_pid].all? { |pid| Process.waitpid(pid); $?.success? } report_success(success)
abort 'Restore failed' unless success
end protected def mysql_args
args = {
'host' => '--host',
'port' => '--port',
'socket' => '--socket',
'username' => '--user',
'password' => '--password',
'encoding' => '--default-character-set'
}
args.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
end def pg_env
ENV['PGUSER'] = config["username"] if config["username"]
ENV['PGHOST'] = config["host"] if config["host"]
ENV['PGPORT'] = config["port"].to_s if config["port"]
ENV['PGPASSWORD'] = config["password"].to_s if config["password"]
end def report_success(success)
if success
$progress.puts '[DONE]'.color(:green)
else
$progress.puts '[FAILED]'.color(:red)
end
end
end
end
#########################################################################
#再次执行备份:
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
#恢复
# Stop processes that are connected to the database
sudo service gitlab stop sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production BACKUP=1474170453 # Options:
BACKUP=timestamp_of_backup (required if more than one backup exists)
force=yes (do not ask if the authorized_keys file should get regenerated)
源码安装gitlab的更多相关文章
- ubuntu 16.04.2 源码安装gitlab并且利用runner持续集成
参考原档:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#using-https 本章只 ...
- gitlab 源码安装=》rpm安装横向迁移(version 9.0)
准备: 下载版本地址: https://packages.gitlab.com/gitlab/gitlab-ce 迁移环境: 源码安装的gitlab9.0.13 目标迁移至9.0.13 RPM安装的环 ...
- mono-3.4.0 源码安装时出现的问题 [do-install] Error 2 [install-pcl-targets] Error 1 解决方法
Mono 3.4修复了很多bug,继续加强稳定性和性能(其实Mono 3.2.8 已经很稳定,性能也很好了),但是从http://download.mono-project.com/sources/m ...
- 搭建LNAMP环境(七)- PHP7源码安装Memcached和Memcache拓展
上一篇:搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展 一.安装Memcached 1.yum安装libevent事件触发管理器 yum -y install libe ...
- 搭建LNAMP环境(二)- 源码安装Nginx1.10
上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel ope ...
- 搭建LNAMP环境(一)- 源码安装MySQL5.6
1.yum安装编译mysql需要的包 yum -y install gcc-c++ make cmake bison-devel ncurses-devel perl 2.为mysql创建一个新的用户 ...
- Greenplum 源码安装教程 —— 以 CentOS 平台为例
Greenplum 源码安装教程 作者:Arthur_Qin 禾众 Greenplum 主体以及orca ( 新一代优化器 ) 的代码以可以从 Github 上下载.如果不打算查看代码,想下载编译好的 ...
- salt源码安装软件和yum安装软件
上面简单列出了源码安装的sls文件书写思路. 涉及到一些固定的思路:如, 1,拷贝 解压安装时候需要依赖tar.gz存在 如果已安装则无需再次安装. 2,启动脚本 加入chk时候需要文件存在,如果已添 ...
- 搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展
上一篇:搭建LNAMP环境(五)- PHP7源码安装Redis和Redis拓展 一.安装MongoDB 1.创建mongodb用户组和用户 groupadd mongodb useradd -r -g ...
随机推荐
- 【LeetCode】1046. Last Stone Weight 解题报告(Python & C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 大根堆 日期 题目地址:https://leetco ...
- Discrete Logging(poj2417)
Discrete Logging Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 5120 Accepted: 2319 ...
- 第十九个知识点:Shamir密钥交换场景
第十九个知识点:Shamir密钥交换场景 Shamir密钥交换场景是一个被Adi Shamir提出的算法.算法允许多方分割一个密码,例如一个密钥.当足够多的秘密结合起来,整个密钥就被计算出来了. 正式 ...
- Linux进程管理之基本指令
目录 基本介绍 显示系统执行的进程 指令 ps - aux 常用选项 每行栏目的含义 查看父进程 终止进程 相关指令 实用案例 踢掉某个非法登录用户 终止远程登录服务sshd,在适当的时候再次重启ss ...
- Java实习生常规技术面试题每日十题Java基础(一)
目录 1.Java 的 "一次编写,处处运行"如何实现? 2.描述JVM运行原理. 3.为什么Java没有全局变量? 4.说明一下public static void main(S ...
- 物联网大赛 - Android学习笔记(三)Android 事件处理
学习目标: 了解事件处理概念 监听事件处理模型 事件与事件监听接口 实现事件监听方式 回调事件处理模型 常见的事件回调方法 Handler类功能与用法 Handler更新程序界面 一.监听概念 再用户 ...
- vue grammer one
本文所有内容均来自 书籍<vue.js实战> 完整代码请查看github v-model <!DOCTYPE html> <html> <head> & ...
- mysql在Linux下大小写敏感设置
默认情况下,mysql在windows下是不区分大小写的,但是mysql在linux下大小写规则是这样的: 1.数据库名与表名是严格区分大小写的: 2.表的别名是严格区分大小写的: 3.列名与列的别名 ...
- 内联模板、X-Template
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <script s ...
- 如何用微信小程序,每天给自己赚个鸡腿?
假期如果实在无聊的话,那跟随田同学的脚步上架一个小程序吧. 话说:谁不想拥有一个自己的小程序呢?既可以赚点小钱又可以长长见识. 不懂小程序的小白能不能做出来呢?那来对了,这个教程就是针对小白的. 今天 ...