ubuntu server conf
ubuntu server conf
linux user manager
$sudo adduser newuser
How To Grant a User Sudo Privileges,Search for the line that looks like this
$visudo
->root ALL=(ALL:ALL) ALL
Below this line, copy the format you see here, changing only the word "root" to reference the new user that you would like to give sudo privileges to:
->root ALL=(ALL:ALL) ALL
->newuser ALL=(ALL:ALL) ALL
How To Delete a User
#deluser newuser
or
#deluser --remove-home newuser
or
#sudo deluser --remove-home newuser
#visudo
->root ALL=(ALL:ALL) ALL
->newuser ALL=(ALL:ALL) ALL # DELETE THIS LINE
Install Nginx, MySQL, PHP (LEMP) Stack On Ubuntu 16.04
Note: Depending on your installation you may need to remove apache2. You can do that by running the commands:
$sudo apt remove apache2*
$sudo apt autoremove
Installing Nginx on Ubuntu 16.04
$sudo apt install nginx
$sudo service nginx start
Installing MySQL on Ubuntu 16.04
#sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
#sudo apt-get update
#sudo apt install mysql-server-5.6 * see note below if you get an error
#sudo apt install mysql-client-5.6
#sudo mysql_secure_installation
#dpkg -l | grep mysql-server
Installing PHP7 on Ubuntu 16.04
$sudo apt install php7.0 php7.0-fpm php7.0-mysql
$apt install libapache2-mod-php7.0 php7.0 php7.0-fpm php7.0-mysql php7.0-cli php7.0-json php7.0-opcache php7.0-readline php7.0-intl php7.0-xml php7.0-mbstring
$sudo apt-get install curl
$sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old
$sudo nano /etc/nginx/sites-available/default
-->
server {
listen 80;
server_name your_site_name.com;
root /usr/share/nginx/html;
index index.php index.html;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
$sudo service nginx restart
nginx + fpm conf
server {
listen 80;
server_name dev.myproj.com;
location ~ \.php$ {
root /var/www/myproj/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
root /var/www/myproj/www;
index index.php;
}
}
server
{
listen 80;
server_name local.emp.clcw.com.cn;
index index.php index.html index.htm;
access_log /var/log/nginx/local.emp.clcw.com.cn.log;
root /home/vagrant/www/emp.clcw.com.cn;
location /
{
if (!-e $request_filename){
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9001;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
if (-f $request_filename) {
expires -1s;
break;
}
}
location ~ /\.ht{
deny all;
}
}
create git repository
Start using Git on the command line
The most common use case for git init --bare is to create a remote central repository:
$ssh <user>@<host> cd path/above/repo git init --bare my-project.git
or
$git init --bare mautic.git
Initializes a new Git repository and copies files from the <template_directory> into the repository.
$git init <directory> --template=<template_directory>
$git clone ssh://john@example.com/path/to/my-project.git
Cloning to a specific folder
$git clone <repo> <directory>
Cloning a specific tag
$git clone -branch <tag> <repo>
Shallow clone
$git clone -depth=1 <repo>
clone only the new_feature branch from the remote Git repository.
$git clone -branch new_feature git://remoterepository.git
This means that a repository will be set up with the history of the project that can be pushed and pulled from, but cannot be edited directly.
$git clone --bare
Git URLs, Git has its own URL syntax which is used to pass remote repository locations to Git commands.
Git URL protocols:
-SSH
$ssh://[user@]host.xz[:port]/path/to/repo.git/
$git clone ssh://coober@192.168.0.62/var/workspace/git_respository/mautic.git
-GIT
$git://host.xz[:port]/path/to/repo.git/
- HTTP
http[s]://host.xz[:port]/path/to/repo.git/
git config
Usage
$git config user.email
git config levels and files:
- --local
Local configuration values are stored in a file that can be found in the repo's .git directory: .git/config
- --global
Global configuration values are stored in a file that is located in a user's home directory. ~ /.gitconfig
- --system
Writing a value
$git config --global user.email "your_email@example.com"
$git config --global merge.tool kdiff3
$ git config --global color.ui false
Aliases
$git config --global alias.ci commit
$git config --global alias.amend git ci --amend
$git --version
$git config --global --list
$git pull REMOTE NAME-OF-BRANCH -u
Create a branch
$git checkout -b NAME-OF-BRANCH
$git checkout NAME-OF-BRANCH
$git status
$git add CHANGES IN RED
$git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"
$git push REMOTE NAME-OF-BRANCH
Delete all changes in the Git repository, but leave unstaged things
$git checkout .
Delete all changes in the Git repository, including untracked files
$git clean -f
Merge created branch with master branch
$git checkout NAME-OF-BRANCH
$git merge master
Merge master branch with created branch
$git checkout master
$git merge NAME-OF-BRANCH
GitLab Installation
官網 https://about.gitlab.com/installation/#ubuntu
文件 https://docs.gitlab.com/ee/README.html
1. Install and configure the necessary dependencies
$sudo apt-get install curl openssh-server ca-certificates postfix
2. Add the GitLab package server and install the package
$curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
$sudo apt-get install gitlab-ce
If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using:
dpkg -i gitlab-ce-XXX.deb
3. Configure and start GitLab
sudo gitlab-ctl reconfigure
4. Browse to the hostname and login
The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish
GitLab start stop
文件 https://docs.gitlab.com/ee/administration/restart_gitlab.html
Omnibus GitLab restart
$sudo service gitlab-ctl status restart stop start
$sudo gitlab-ctl restart nginx
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
$sudo gitlab-ctl kill <service>
Reconfigure Omnibus GitLab with:
$sudo gitlab-ctl reconfigure
GitLab User Account
文件 https://docs.gitlab.com/ee/ssh/README.html
Before generating a new SSH key pair check if your system already has one at the default location by opening a shell, or Command Prompt on Windows, and running the following command:
Windows Command Prompt:
$type %userprofile%\.ssh\id_rsa.pub
Git Bash on Windows / GNU/Linux / macOS / PowerShell:
$cat ~/.ssh/id_rsa.pub
Generating a new SSH key pair
$ssh-keygen -t rsa -C "your.email@example.com" -b 4096
Note: If you want to change the password of your SSH key pair, you can use
$ssh-keygen -p <keyname>.
GitLab server conf
文件
conf in:
/etc/gitlab/gitlab.rb
install in:
/var/opt/gitlab/git-data/
#grep -v '#' gitlab.rb |grep -v ^$
->external_url 'http://192.168.0.62:8081'
->gitlab_rails['gitlab_shell_ssh_port'] = 81
->nginx['listen_addresses']= ['192.168.0.62']
access gitlab from browser
http://192.168.0.62:8081
Username: root
Password: 5iveL!fe 12345678
change password for root:
gitlab-rails console production
->user = User.where(id: 1).first or user = User.find_by(email: 'admin@local.host')
->user.password = 'secret_pass'
->user.password_confirmation = 'secret_pass'
->user.save!
--gitlab backup---------
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
write conf /etc/gitlab/gitlab.rb
->gitlab_rails['backup_path'] = '/mnt/backups'
recover
gitlab-rake gitlab:backup:restore BACKUP=1393513186
create database db_linkall_demo default charset utf8 collate utf8_general_ci;
->grant all privileges on db_linkall_demo.* to dbuser@localhost identified by ‘111111’;
->flush privileges;
相關文章
- Ubuntu上ftp的vsftpd.conf檔案的配置UbuntuFTP
- Ubuntu Server 24 安裝 PrometheusUbuntuServerPrometheus
- Ubuntu Server 基礎應用UbuntuServer
- VMware 安裝 Ubuntu Server 18.04.5 LTSUbuntuServer
- Ubuntu 20.04 LTS Server搭建軟路由UbuntuServer路由
- virtualbox ubuntu 安裝 openssh-serverUbuntuServer
- ubuntu ftp 伺服器搭建及vsftpd.conf配置例項詳解UbuntuFTP伺服器
- Ubuntu Server 24.04 自啟動服務UbuntuServer
- Ubuntu Server 24.04 LTS 安裝記事UbuntuServer
- Ubuntu 20.04 安裝VNC Server的教程。UbuntuVNCServer
- Ubuntu Server搭建個人伺服器UbuntuServer伺服器
- Ubuntu server 20.04詳細安裝教程UbuntuServer
- Ubuntu 16.04 Server 設定靜態IPUbuntuServer
- Luckfox Pico Ubuntu server 安裝桌面環境UbuntuServer
- Ubuntu Server安裝介面並VNC連線UbuntuServerVNC
- Ubuntu Server18.04 靜態 IP 配置教程UbuntuServer
- 【Ubuntu】Win11 VmWare虛擬機器安裝Ubuntu 22.04.1-serverUbuntu虛擬機Server
- Ubuntu Server 24.04 LTS 安裝 Docker 與 Docker ComposeUbuntuServerDocker
- Ubuntu14.04 Server 升級到14.10 的方法UbuntuServer
- 通過 PXE 自動化安裝 Ubuntu ServerUbuntuServer
- Ubuntu Server 16.04.1 LTS 64位 搭建LNMP環境UbuntuServerLNMP
- Laravel Conf China 大使Laravel
- 華為雲Ubuntu 22.04 server 64bit 安裝dockerUbuntuServerDocker
- Ubuntu server 24.04 LTS 安裝後要做的工作記事UbuntuServer
- Ubuntu 18.04 server安裝+搭建Seacms v10.1網站UbuntuServerACM網站
- Ubuntu Server 16.04伺服器版安裝圖解教程UbuntuServer伺服器圖解
- postgresql關於postgresql.auto.conf和postgresql.conf的區別SQL
- redis.conf 常用配置Redis
- Weex + Ui – Weex Conf 2018UI
- nginx: [emerg] "user" directive is not allowed here in /etc/nginx/conf.d/nginx.conf:1Nginx
- 安裝並使用 Ubuntu Server 的一些注意事項UbuntuServer
- VMware 虛擬機器圖文安裝和配置 Ubuntu Server 22.04虛擬機UbuntuServer
- windows 中nginx奇葩報錯 nginx: [emerg] unknown directive "#" in nginx/conf/nginx.conf:3WindowsNginx
- Oracle:/etc/security/limits.confOracleMIT
- vsftpd.conf 配置詳解FTP
- Laravel Conf China 2019 之 李煜Laravel
- 為 .NET Conf 2024 做好準備之本地社群活動 .NET Conf China 2024 啟動
- 烏班圖Ubuntu 24.04 SSH Server 修改預設埠重啟無效UbuntuServer
- supervisor.conf部署及維護