gitlab 雜記

GitLab 編譯部署

1,請盡量不要在國內主機上部署,中途天朝很有可能導致gem執行出現問題,以下在AWS上部署;

2,系統中必須要有swap分區,不然會出現500錯誤;

===============================================

系統版本:CentOS 6.x x86_64 mini

Gitlab版本:6.x-7.x

———————————–基本配置——————————–

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config?
setenforce 0?
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm?
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm?
yum -y install wget nano perl perl-Net-SSLeay rsync openssh openssh-clients openssh-server iotop atop htop iftop glances?
wget http://sourceforge.net/projects/webadmin/files/webmin/1.730/webmin-1.730-1.noarch.rpm/download?
rpm -Uvh download?
yum clean all?
rm -rf download?
————————————-升級軟件包(必須)—————————–

yum makecache?
yum 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 yum-plugin-fastestmirror cmake patch libicu-devel

如果遇到多個源的包沖突添加–skip-broken參數跳過即可。

解決libyaml的問題

yum downgrade libyaml libyaml-devel

yum install libyaml libyaml-devel

———————————————————————-

yum -y install vim-enhanced nano

update-alternatives –set editor /usr/bin/vim.basic

yum -y install python-docutils

————————————-安裝redis———————————

yum install redis -y

chkconfig redis on

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

sed ‘s/^port .*/port 0/’ /etc/redis.conf.orig | sudo tee /etc/redis.conf

echo ‘unixsocket /var/run/redis/redis.sock’ | sudo tee -a /etc/redis.conf

echo -e ‘unixsocketperm 0770’ | sudo tee -a /etc/redis.conf

mkdir /var/run/redis

chown redis:redis /var/run/redis

chmod 755 /var/run/redis

if [ -d /etc/tmpfiles.d ]; then

??? echo ‘d? /var/run/redis? 0755? redis? redis? 10d? -‘ | sudo tee -a /etc/tmpfiles.d/redis.conf

fi

usermod -aG redis git

service redis restart

—————————————-安裝郵件—————————–

yum -y install postfix

ln -s /usr/bin/vim /usr/bin/editor

————————————————————————–

必須首先刪除自帶的ruby和git

yum remove ruby git -y

yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel

—————————————安裝git———————————–

curl –progress https://www.kernel.org/pub/software/scm/git/git-2.2.2.tar.gz | tar xz

cd git-2.2.2/

./configure

make

make prefix=/usr/local install

which git

echo ‘export PATH="$PATH:/usr/local/bin"’ >> /root/.bashrc

echo ‘export PATH="$PATH:/usr/local/bin"’ >> /etc/profile

source /etc/profile

echo $PATH

git –version

cd && rm -rf git-*

—————————————安裝ruby——————————–

yum install libffi-devel -y

Ruby (MRI)版本:2.0 or 2.1(測試ruby2.2與gitlab7.7不兼容)

curl –progress http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p598.tar.gz | tar xz

curl –progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz

cd ruby-*

./configure –disable-install-rdoc

make clean && make

make prefix=/usr/local install

which ruby

ruby -v

cd && rm -rf ruby-*

———–ruby降級操作—————

1,root身份重新編譯舊版本

2,root身份執行:

chmod 0775 /usr/local/lib/ruby/gems/ -R

chgrp git /usr/local/lib/ruby/gems/ -R

chmod 0775 /usr/local/bin -R

chgrp git /usr/local/bin -R

3,git身份執行:

su git

cd /home/git/gitlab

gem install bundler

gem install bundle

bundle install

———————————————————————–

國外服務器不需要以下操作

gem sources –remove?https://rubygems.org/

gem source -a?http://ruby.taobao.org/

gem sources -l

gem install bundler

gem install rugged

————————————添加系統用戶(必須)———————————

adduser –system –shell /bin/bash –comment ‘GitLab’ –create-home –home-dir /home/git/ git

visudo

Defaults??? secure_path = /sbin:/bin:/usr/sbin:/usr/bin

改為

Defaults??? secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

————————————-數據庫配置MySQL和Postgre(選其一)———————————-

yum remove postgresql -y

rpm -Uvh?http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm

yum install postgresql94-server postgresql94-devel -y

以下可略過

echo ‘export PATH="$PATH:/usr/pgsql-9.4/bin"’ >> /root/.bashrc

echo ‘export PATH="$PATH:/usr/pgsql-9.4/bin"’ >> /etc/profile

source /etc/profile

echo $PATH

mv /etc/init.d/{postgresql-9.4,postgresql}

service postgresql initdb

which psql

psql -V

service postgresql restart

chkconfig postgresql on

su – postgres

export PATH=$PATH:/usr/pgsql-9.4/bin/

psql -d template1

create user git createdb;

create database gitlabhq_production owner git;

\q

exit

whoami

nano /var/lib/pgsql/9.4/data/pg_hba.conf

??? host all all 127.0.0.1/32 trust

trust授權本地可以無需賬戶密碼直接訪問。

————————————–安裝gitlab———————————

cd /home/git

sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-6-stable gitlab

cd /home/git/gitlab

sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

sudo -u git -H nano config/gitlab.yml

? gitlab:

??? host: git.dayunet.com

??? port: 8080

??? https: false

? git:

bin_path: /usr/local/bin/git

chown -R git log/

chown -R git tmp/

chmod -R u+rwX log/

chmod -R u+rwX tmp/

sudo -u git -H mkdir /home/git/gitlab-satellites

chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites

chmod -R u+rwX tmp/pids/

chmod -R u+rwX tmp/sockets/

chmod -R u+rwX? public/uploads

sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb

nproc

sudo -u git -H nano config/unicorn.rb

可修改工作進程數和監聽地址及端口。

——————————————-

sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb

sudo -u git -H git config –global user.name "GitLab"

sudo -u git -H git config –global user.email "yutaoo1230@gmail.com"

sudo -u git -H git config –global core.autocrlf input

sudo -u git -H cp config/resque.yml.example config/resque.yml

sudo -u git -H nano config/resque.yml

??? production: unix:/var/run/redis/redis.sock

sudo -u git -H nano config/gitlab.yml

??? host: git.dayunet.com

??? port: 80

??? https: false

??? user: git

??? time_zone: ‘Asia/Shanghai’

??? email_from: yutaoo1230@163.com

? git:

??? bin_path: /usr/local/bin/git

??? max_size: 209715200000

??? timeout: 100

sudo -u git -H nano config/environments/production.rb

??? config.action_mailer.delivery_method = :smtp

sudo -u git -H cp config/initializers/smtp_settings.rb.sample config/initializers/smtp_settings.rb

sudo -u git -H nano config/initializers/smtp_settings.rb

? ActionMailer::Base.smtp_settings = {

??? address: "smtp.163.com",

??? port: 25,

??? user_name: "yutao@163.com",

??? password: "123456",

??? domain: "163.com",

??? authentication: :login,

??? enable_starttls_auto: false

sudo -u git -H nano config/initializers/devise.rb

? config.mailer_sender = "DayunetGit <#{Gitlab.config.gitlab.email_from}>"

sudo -u git cp config/database.yml.postgresql config/database.yml

sudo -u git -H chmod o-rwx config/database.yml

sudo -u git -H nano config/database.yml

??? production:

????? adapter: postgresql

????? encoding: unicode

????? database: gitlabhq_production

????? pool: 10

———————————-安裝Gem————————————-

cd /home/git/gitlab

chmod ugo+rx /usr/local/bin/bundle

chmod -R ugo+rX /usr/local/lib/ruby/

rm -fv /usr/bin/{bundle,bundler}

ln -s /usr/local/bin/bundle /usr/bin/bundle

ln -s /usr/local/bin/bundler /usr/bin/bundler

sudo -u git -H bundle config build.pg –with-pg-config=/usr/pgsql-9.4/bin/pg_config

sudo -u git -H bundle install –deployment –without development test mysql aws

如果在國內需要更換源

nano /home/git/gitlab/Gemfile

??? source "http://ruby.taobao.org"

postgresql數據庫使用:

sudo -u git -H bundle install –deployment –without development test mysql aws

mysql數據庫使用:

sudo -u git -H bundle install –deployment –without development test postgres aws

———————————-安裝gitlab-shell————————————-

cd /home/git/gitlab?
netstat -ntlp

sudo -u git -H bundle exec rake gitlab:shell:install[v2.4.1] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production

sudo -u git -H nano /home/git/gitlab-shell/config.yml

??? user: git?
??????? gitlab_url: http://127.0.0.1:8080/

restorecon -Rv /home/git/.ssh

———————————–初始化數據庫并設置密碼——————————–

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

wget -O /etc/init.d/gitlab https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/sysvinit/centos/gitlab-unicorn

chmod +x /etc/init.d/gitlab?
chkconfig –add gitlab?
chkconfig gitlab on?
cp /home/git/gitlab/lib/support/logrotate/gitlab /etc/logrotate.d/gitlab

————————————–檢查環境并編譯————————————–

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

service gitlab restart

netstat -ntlp

——————————–導入ssh-keys—————————————-

su git

cd

ssh-keygen -t rsa -C "mail@qq.com"

cat ~/.ssh/id_rsa.pub

將該結果填入GitLab的ssh-keys。

私鑰文件為

/home/git/.ssh/id_rsa

該文件為客戶端使用。

——————————-Nginx安裝——————————————-

nginx最少1.4版本以上,不然會報錯:

fatal: protocol error: bad line length character

自簽名證書在客戶端通過https推送或提交時會報錯。

安裝Nginx請參考編譯安裝筆記,本文以 nginx 1.6.2 為例。

chkconfig nginx on

chkconfig httpd off?
wget -O /etc/nginx/conf.d/gitlab.conf https://gitlab.com/gitlab-org/gitlab-ce/raw/master/lib/support/nginx/gitlab-ssl

usermod -a -G git nginx

chmod g+rx /home/git/?
service nginx restart

上傳證書文件并修改主機名

nano /etc/sysconfig/network

nano /etc/hosts

注意:

配置文件中的代理配置

??? proxy_set_header??? X-Forwarded-Ssl???? on;

也能起到

??? return 301 https://$server_name$request_uri;

的作用,請注意這個重定向功能。

————————————-添加防火墻———————————-

lokkit -s http -s https -s ssh

lokkit -p 10000:tcp

lokkit -p 10001:tcp

service iptables restart

========================測試安裝結果========================

cd /home/git/gitlab

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

chkconfig gitlab on?
chkconfig nginx on?
chkconfig redis on

service nginx restart

service redis restart

service gitlab restart

?

GitLab 常見問題解決

=========================常見故障解決====================

報錯:

Git configured for git user? … no

解決:

sudo -u git -H git config –global user.name "GitLab"?
sudo -u git -H git config –global user.email "yutao@163.com"?
sudo -u git -H git config –global core.autocrlf "input"

————————————————————–

報錯:

GitLab Shell version >= 1.9.7 ? … FAIL. Please update?gitlab-shell to 1.9.7 from 1.9.6

解決:

sudo -u git -H bundle exec rake?gitlab:shell:install[v1.9.7] REDIS_URL=redis://localhost:6379 RAILS_ENV=prodduction

—————————————————

報錯:

Satellites access is drwxr-x—? … no

解決:

sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites

—————————————————

報錯:

Init script up-to-date? … no

解決:

cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab

文件大小為8K,2K大小的不是最新的;

—————————————————

報錯:

gitlab-shell self-check failed

解決:

Gitlab-Shell通過http調用gitlab的API,那可能是配置的API接口不對(ip,端口等)。?
gitlab的配置依賴于三個文件:?
/home/git/gitlab/config/unicorn.rb:配置ruby提供的服務端口,ip?
/home/git/gitlab/config/gitlab.yml:配置gitlab服務的端口,ip?
/home/git/gitlab-shell/config.yml:配置gitlab-shell要調用的API接口?
這三個文件的配置要保持一致,只需要更改ip和端口就可以了,其他不用動。

例如:?
unicorn.rb:第40行改成?
listen "115.28.21.20:8000", :tcp_nopush => true?
gitlab.yml:第18行和第19行改成?
host: 115.28.21.20?
port: 8000?
config.yml:第5行改成?
gitlab_url: "http://localhost:8000/"?
再檢測一次,gitlab-shell應該會正確連接到gitlab,檢測結果為yes。

這里改為非80端口也可,只要Nginx或Apache是通過80或443登錄訪問即可。?
———————————————–

報錯:

can’t check, you have no projects

can’t create, repository is empty

解決:

登錄后創建項目并添加文件即可。

———————————————————–

配置smtp發送郵件

config/environments/production.rb

編輯?

config.action_mailer.delivery_method= :smtp

再編輯 config/initializers/smtp_settings.rb

if Gitlab::Application.config.action_mailer.delivery_method == :smtp

? ActionMailer::Base.smtp_settings = {

??? address: "smtp.domain.com",

??? port: 587,

??? user_name: "mail_username",

??? password: "mail_password",

??? domain: "domain.com",

??? authentication: ‘plain’,

??? enable_starttls_auto: true

? }end

Tip: 如果沒用smtp沒有開加密連接的話 enable_starttls_auto 的值應該配置為 false

這里需要注意一個問題, 如果你的smtp服務器做了權限限制,只能以登陸賬戶的郵件帳號發郵件的話,還需要修改編輯config/gitlab.yml 找到下面兩個字段將內容改成你的郵件帳戶地址:

email_from: yourmail@domain.com

support_email: yourmail@domain.com

如果用docker來運行的話還需要修改 /home/git/gitlab/docker 的配置即可。

——————————————————————————-

報錯:

remote: /usr/local/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill’: Net::ReadTimeout (Net::ReadTimeout)

解決:

nano /home/git/gitlab/config/unicorn.rb

worker_processes 2

———————————————————————

減少內存占用:

修改 /home/git/gitlab/config/unicorn.rb:

worker_processes 2

減少進程數即可,但是性能會降低,并有可能出現上面的網絡超時錯誤。

——————————————————-

報錯:

error rpc failed result=18 http code = 200

解決:

git config –global http.postBuffer 524288000

git config –global https.postBuffer 524288000

——————————————————-

報500錯誤

原因:內存不足

解決:增加swap(文件方式)

創建文件

dd if=/dev/zero of=/var/tmp/swap bs=1024 count=1024000

cd /var/tmp

制作swap格式文件

mkswap swap

文件生效

swapon swap

查看swap

swapon -s

開機自動掛載

nano /etc/fstab

?? /var/tmp/swap??? swap???? swap?? defaults??????? 0 1

無需重啟掛載分區

mount -a

查看結果

free -m

———————————————————-

報錯:

remote: GitLab: No such project

[remote rejected] master -> master (pre-receive hook declined)

?

或者執行檢查后提示:

Projects have satellites? …

MTao / GitLab … can’t create, repository is empty

解決:

gitlab-satellites下無法創建文件,原因是使用了文件夾硬連接導致的,取消即可。

————————————————————-

報錯:

try increasing http.postBuffer

解決:

sudo -u git -H git config http.postBuffer 52428800000

?

轉載于:https://www.cnblogs.com/tonjocelyn/p/5227216.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/255887.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/255887.shtml
英文地址,請注明出處:http://en.pswp.cn/news/255887.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Hadoop分布式系統的安裝部署

1、關于虛擬機的復制 新建一臺虛擬機&#xff0c;系統為CentOS7&#xff0c;再克隆兩臺&#xff0c;組成一個三臺機器的小集群。正常情況下一般需要五臺機器&#xff08;一個Name節點&#xff0c;一個SecondName節點&#xff0c;三個Data節點。&#xff09; 此外&#xff0c;為…

Windows線程調度學習(一)

前言 Windows 線程調度器的實現分散在內核各處&#xff0c;并且與許多組件都有關聯&#xff0c;很難進行系統地學習&#xff0c;所以我打算寫幾篇文章來記錄下自己學習過程中的思考和分析&#xff0c;同時也方便日后查閱&#xff0c;此文可以看作是《Windows內核原理與實現》中…

機器人的有效負荷

問題&#xff1a; 假如我想在程序里做多幾個有效載荷,但在手動操縱畫面上只能加一個,其它要怎樣用?給個實際例子給我啊. 回答&#xff1a; 在搬運中&#xff0c;確實是有載荷發生變化的情況&#xff0c;如兩抓(A B)的夾具&#xff0c;有三種載荷情況&#xff0c;1、A抓有載荷…

【Python生成readme文件】——Markdown語法

鏈接&#xff1a;https://www.cnblogs.com/wj-1314/p/8547763.html

編程之美2.13子數組的最大乘積

題目&#xff1a; 給定一個長度為N的數組&#xff0c;只許用乘法&#xff0c;不許用除法&#xff0c;計算任意&#xff08;N-1&#xff09;個數的組合中乘積最大的一個組&#xff0c;并寫出算法的時間復雜度。 如果把所可能的乘積找出來&#xff0c;共有&#xff08;N-1&#x…

[SceneKit專題]11-Reference-Nodes引用節點

說明 本系列文章是對<3D Apple Games by Tutorials>一書的學習記錄和體會 此書對應的代碼地址 SceneKit系列文章目錄 本文將完成一個完整的node節點,帶有完整貼圖,并將其導入其他場景中,成為其中的一個引用節點.這樣可以更方便的組織場景,并能復用場景中的節點,正類似于面…

scapy 安裝及簡單測試

關于scapy Scapy的是一個強大的交互式數據包處理程序&#xff08;使用python編寫&#xff09;。它能夠偽造或者解碼大量的網絡協議數據包&#xff0c;能夠發送、捕捉、匹配請求和回復包等等。它可以很容易地處理一些典型操作&#xff0c;比如端口掃描&#xff0c;tracerouting&…

MoveAbsJ在使用時和MOVEJ有什么區別

問 題&#xff1a; MoveAbsJ在使用時和MOVEJ有什么區別 回 答&#xff1a; MoveAbsJ的目標點是用六個軸伺服電機的偏轉角度值來指定的。 MOVEJ和MOVEL的目標點是用坐標系X Y Z的值來指定的。

Python中的序列操作

Python中的序列操作 分類: python undefined 官方手冊&#xff1a;https://docs.python.org/3.7/library/stdtypes.html#sequence-types-list-tuple-range 序列簡介 序列是指按照位置順序來存儲數據的數據結構&#xff0c;也就是說能通過數值索引進行操作。實際上&#x…

automaticallyAdjustsScrollViewInsets的作用

簡單點說就是automaticallyAdjustsScrollViewInsets根據按所在界面的status bar&#xff0c;navigationbar&#xff0c;與tabbar的高度&#xff0c;自動調整scrollview的 inset,設置為no&#xff0c;不讓viewController調整&#xff0c;我們自己修改布局即可~轉載于:https://ww…

JavaScript 基礎知識 - BOM篇

前言 本篇文章是JavaScript基礎知識的BOM篇&#xff0c;如果前面的《JavaScript基礎知識-DOM篇》看完了&#xff0c;現在就可以學習BOM了。 注意&#xff1a; 所有的案例都在這里鏈接: 提取密碼密碼: yvxo&#xff0c;文章中的每個案例后面都有對應的序號。 1. BOM 基本概念 B…

全球首例機器人自殺事件 因受夠無聊家務

據鳳凰網,一個奧地利家庭購買一小機器人,每天工作就是倒垃圾、倒垃圾。一天完工后,它竟自己啟動,爬到爐邊&#xff0c;推開上面的鍋&#xff0c;把自己活活燒死…專家稱這個機器人實在受夠了無聊的家務瑣事&#xff0c;才毅然選擇自殺機器人也是有尊嚴的!為這有骨氣的robot點根…

【python基礎】——數據類型(列表、字典、集合)

駿馬金龍——python語法基礎 python基礎 變量與運算 符號//%**意義整除整除取余冪次方數據種類 #mermaid-svg-7nSRRijcYFCYwTDr .label{font-family:trebuchet ms, verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-7nSRRijcYFCYw…

linux命令:mkdir命令

命令參數&#xff1a; -m, --mode模式&#xff0c;設定權限<模式> (類似 chmod)&#xff0c;而不是 rwxrwxrwx 減 umask -p, --parents 可以是一個路徑名稱。此時若路徑中的某些目錄尚不存在,加上此選項后,系統將自動建立好那些尚不存在的目錄,即一次可以建立多個目錄; …

js設置奇偶行數樣式

$(document).ready(function () {odd { "background": "none" }; //奇數樣式 even { "background": "#f3f3f3" }; //偶數樣式 odd_even(".gys_xq", odd, even);});function odd_even(id, odd, even) {$(id).find("…

貝塞爾曲線切割圓角

ios 系統框架已經給我們提供了相應的切割圓角的方法, 但是如果在一個見面有很多控件切割的話會出現卡頓和個別不切的現象 ?123456789101112131415161718192021222324252627/* 創建一個Button */UIButton * button [UIButton buttonWithType:(UIButtonTypeSystem)];[button se…

機器人實現屠宰自動化

當 WESTFLEISCH 注冊合作社考慮在 Coesfeld 肉類加工中心內自動化原有的人工屠宰設備過程時&#xff0c;首先在“剔除直腸”及“切開盆腔骨及腹部”兩個流程中測試使用了兩臺庫卡機器人。在此過程中&#xff0c;機器人主要以它工作的質量及經濟效益說服了使用者。 實施措施/解…

DOM編程藝術12章

在submit.html中&#xff0c;代碼簡略成如下也行 <article><h1>Thanks!</h1><p>Thanks for contacting us. Well get back to you as soon as we can.</p></article> </body> </html> 說明了只是插入article的部分&#xff0c…

python數據結構《排序專題復習》

目錄 常見的三種排序方法 冒泡排序 插入排序 選擇排序 其他經典的排序方法 快速排序 堆排序 歸并排序 希爾排序 不同排序方法的各維度對比 排序方式的穩定性&#xff1a;若兩個相同的元素在排序前后的相對位置不發生改變的排序為穩定排序&#xff0c;否則不穩定排序 常…

BZOJ2844 albus就是要第一個出場

AC通道&#xff1a;http://www.lydsy.com/JudgeOnline/problem.php?id2844 這題貌似HDU上有一道差不多的題&#xff0c;不過我沒做過&#xff0c;也就沒管了。 首先講一個線性基的東西&#xff0c;大概就是這樣&#xff1a; 然后就是一個什么性質&#xff1a;S異或起來會出現重…