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

  • 文档 https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init

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 server conf的更多相关文章

  1. PhoneGap / iOS上的SQLite数据库 – 超过5mb可能

    我误解了什么吗?Phonegap中的sqlitedbs真的有5mb的限制吗?我正在使用Phonegap1.2和iOS5.解决方法您可以使用带有phonegap插件的原生sqliteDB,您将没有任何限制.在iOS5.1中,Websql被认为是可以随时删除的临时数据…

  2. ios – 使用带有NodeJs HTTPS的certificates.cer

    我为IOS推送通知生成了一个.cer文件,我希望将它与NodeJSHTTPS模块一起使用.我发现HTTPS模块的唯一例子是使用.pem和.sfx文件,而不是.cer:有解决方案吗解决方法.cer文件可以使用两种不同的格式进行编码:PEM和DER.如果您的文件使用PEM格式编码,您可以像使用任何其他.pem文件一样使用它(有关详细信息,请参见Node.jsdocumentation):如果您的文件使

  3. ios – CFNetwork内部错误:URLConnectionLoader.cpp:289

    当我在一段时间后打开我的应用程序时,我收到了日志:440:CFNetworkinternalerror(0xc01a:/buildroot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-758.4.3/Loading/URLConnectionLoader.cpp:289)它从未出现在过去.我的项目使用网络库AFNetworkin

  4. ios – 使用大写符号在字符串swift中获取URL的正则表达式

    我尝试在文本中获取URL.所以,在此之前,我使用了这样一个表达式:但是当用户输入带有大写符号的URL时(例如Http://Google.com,它与它不匹配)我遇到了问题.我试过了:但什么都没发生.解决方法您可以使用正则表达式中的i内联标志关闭区分大小写,有关可用正则表达式功能的详细信息,请参阅FoundationFrameworkReference.(?ismwx-ismwx)Flagsetti

  5. ios – didUpdateLocations从未调用过

    我正在尝试获取用户的位置.为此,我在info.plist中设置了以下属性:我还在viewDidLoad方法中添加了以下代码以及下面的函数.问题是locationManager(manager,didUpdate…

  6. ios – 重命名并重写为Swift后对象解码崩溃

    由于我们已经重命名了(Bestemming–>Place)类并将其从Objective-c重写为Swift,因此一些用户会遇到崩溃.我们正在尝试使用NSCoding原则从NSUserDefaults加载对象.碰撞:班级:从NSUserDefaults阅读:崩溃日志说它在第0行崩溃,这是注释所以我认为它在init方法中崩溃,我认为它与一个null为空但不能为null的对象有关.我尝试过的:>尝试在S

  7. 适用于iOS的Google Maps SDK不断增加内存使用量

    我已经构建了一个在地图上显示标记的简单应用程序,我从服务器的JSON文件加载其x,y,标记是可点击的,所以一旦你在任何标记上它将你带到另一个UIViewController(我们将它命名为BViewController).我已经监视了内存使用情况,所以每次我从BViewController返回到MapViewController(里面的地图)时,它只是内存使用量的两倍我尝试将其设置为nill或从s

  8. ios – 未提示在应用程序中启用位置服务

    更新:这不是重复.我已经在info.plist中添加了所需的密钥,如我原始问题中所述,问题仍然存在.我已经尝试了各种组合的所有三个键.在任何人感到不安之前,我已阅读了许多AppleDev论坛帖子和堆栈溢出帖子,无法弄清楚为什么我的应用程序拒绝提示用户允许使用时授权.我已将以下密钥添加到我的Info.plist文件中,并附带一个String值:然后我写了(在Swift和Obj-C中)应该提示用户的代

  9. ios – 在UIViewController显示为3DTouch预览时检测UITouches

    是否有可能从UIViewController检测触摸并获取触摸的位置,UIViewController当前用作3DTouch的previewingContext视图控制器?

  10. ios – xcode在更新可可豆荚后出现体系结构错误的重复符号

    编辑:执行下面显示的解决方案后,我的项目只编译iPadAir,我不能再存档,我仍然得到相同的错误…

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部