This article was first published on the official website of Luozhu, welcome to visit, reprint please contact the author on wechat to obtain authorization.

Homebrew

Access the brew.sh installation. Using Homebrew to install Apple (or your Linux system) doesn’t come preloaded but you need something. Homebrew will significantly reduce the time required to maintain your environment. Homebrew will be used wherever possible later in this article.

  • brew installInstallation:
  • brew uninstalluninstall
  • brew updateUpdate homebrew:
  • brew upgrade: Updates the installed software
  • brew cleanup: clean up
  • brew update && brew upgrade && brew cleanup: One-click clearing

Uninstall script:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Copy the code

ohmyzsh

# Switch shell to ZSH
$ chsh -s /bin/zsh
Install ohmyzsh with curl
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Copy the code

Agnoster Theme configuration

I’m currently using the YS theme

  • The terminal executionopen ~/.zshrc
  • Find ZSH_THEME and change it to:ZSH_THEME="agnoster"
  • source ~/.zshrc
  • Install font libraries for Powerline
    • git clone https://github.com/powerline/fonts.git
    • cd fonts
    • install.sh
    • cd ..
    • rm -rf fonts
    • Go to terminal > Preferences > Change the font to:Meslo LG S DZ Regular for Powerline.

The plug-in

zsh-syntax-highlighting

  • Installation:brew install zsh-syntax-highlighting
  • Oh-my-zsh
    • git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    • plugins=( [plugins...] zsh-syntax-highlighting)
    • source ~/.zshrc

WakaTime for Terminal

  • Sudo easy_install PIP = = 20.3.4
  • sudo easy_install pip
  • sudo pip install wakatimePlease use | if failurePIP install -- target = / Library/Python / 2.7 / site - packages wakatime
  • cd ~/.oh-my-zsh/custom/plugins
  • git clone https://github.com/sobolevn/wakatime-zsh-plugin.git wakatime
  • In your~/.zshrcOf the filelist of pluginsaddwakatime
  • addThe export PATH = "/ Users/luozhu/Library/Python / 2.7 / bin/"~/.zshrc
  • source ~/.zshrc
  • Make sure the API key is configured in your ~/.wakatime. CFG file.

vim

You are advised to use github.com/amix/vimrc

$ git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
$ sh ~/.vim_runtime/install_awesome_vimrc.sh
$ echo "set number" >> ~/.vimrc
$ echo "set showcmd" >> ~/.vimrc
$ source ~/.vimrc
Copy the code

Git

Command line tool

// Re-installing Git on Mac OSX with Brew
$ alias git='/usr/local/bin/git'
$ brew install git
Copy the code

Command Line Configuration

# 1. Initialize Settings
$ git config --global user.name 'youngjuning'
$ git config --global user.email '[email protected]'
# 2. Setting 'color. UI' to 'auto' makes the output of the command more readable.
$ git config --global color.ui auto
Git remembers the username and password
$ git config --global credential.helper store
# 4, the core autocrlf
$ git config --global core.autocrlf input
# 5. Output to Terminal instead of vim
$ git config --global pager.branch false
Copy the code

Linux or Mac systems use LF as the line terminator, so you don’t want Git to automatically convert files when checking them out; For example, if a file ends at the end of a line (CRLF) then you might want to modify it by changing core. Trigger LF to input and then forcing Git to change CRLF to LF at commit and end at checkout: This preserves CRLF in checkout files on Windows systems, and IT preserves LF on Mac and Linux systems, including repositories.

Learning materials

  • The official Book
  • Git – Simple Guide: A simple guide to getting started with Git
  • Git tutorial by Liao Xuefeng
  • Even monkeys can understand GIT introduction

Node

Node.js is a JavaScript runtime based on the Chrome V8 engine. We use the n module to maintain the version of Node:

$ brew install n
#Install the latest version
$ sudo n latest
## Other commands ##
#Install the specified version
$Sudo n 10.16.0
#Install the latest stable version
$ sudo n lts
#Delete the specified version
$N the rm 12.10.0
#All cached versions except the current version
$ n prune
Copy the code

Update the NPM

$ sudo npm install -g npm
Copy the code

NRM management registry

$ sudo i -g nrm
#Lists the available agents
$ nrm ls
#Adding a Private Proxy
$ nrm add local http://127.0.0.0:4873 http://127.0.0.0:4873
Copy the code

d8

Do not use Brew Install V8, available commands are incomplete

Preparation conditions

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • cd ~ && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.zshrc(zsh) or sudo nano ~/.bash_profile(bash)
    • Add export PATH=~/depot_tools:"$PATH" (it’s important that depot_tools comes first here)
    • source ~/.zshrc
    • From the directory you want to install V8 into, run gclient

Build V8

  • fetch v8
  • cd ~/v8
  • gclient sync
  • tools/dev/v8gen.py x64.optdebug
  • ninja -C out.gn/x64.optdebug (prepare for lots of fan noise)

I’d also recommend adding these to your .zshrc:

  • sudo nano ~/.zshrc
  • Add alias d8=~/v8/out.gn/x64.optdebug/d8
  • Add alias tick-processor=~/v8/tools/mac-tick-processor
  • Add export D8_PATH="~/v8/out.gn/x64.optdebug"
  • source ~/.zshrc

For details about how to use Demo, see D8-shell-examples

Java

Download and install

  • javase-jdk8-downloads
  • The Oracle Java archive

Practical command

  • Check the JDK version and installation directory /usr/libexec/java_home -v in Mac

    Matching Java Virtual Machines (2):
     1.8.0_221, x86_64:	"Java SE 8"/ Library/Java/JavaVirtualMachines jdk1.8.0 _221. JDK/Contents/Home 1.7.0 _80, x86_64:"Java SE 7"/ Library/Java/JavaVirtualMachines jdk1.7.0 _80. JDK/Contents/Home / Library/Java/JavaVirtualMachines jdk1.8.0 _221. JDK/Contents/HomeCopy the code
  • Check the JRE version: Java-version

  • Check the JDK version: javac-version

Maven

The installation

$ brew install maven
Copy the code

Configure the Maven local repository

The setting. XML path is ${Maven Home}/conf/settings. XML. Maven Home can be obtained from MVN –version

<localRepository>~/maven_repo</localRepository>
Copy the code

You can copy settings. XML directly to the.m2 folder for configuration.

If there is no.m2 folder, run the command

$ mvn help:system
Copy the code

Then open the current user’s directory, where you can find the.m2 folder

Configuring Ali Mirror

<mirror>
  <id>alimaven</id>
  <name>aliyun maven</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>
</mirror>
Copy the code

To upgrade the Maven

$ brew unlink
$ brew update
$ brew install maven
Copy the code

MySql

$ brew install mysql
Copy the code

Modifying a Configuration File

$ nano /usr/local/etc/my.cnf
Copy the code

Start the service

brew services start mysql
#restart
brew services restart mysql
#stop
brew services stop mysql
Copy the code

Or, if you don’t want/need a background service you can just run: mysql.server start

Security Settings

$ mysql_secure_installation
Copy the code
  1. Set up a password authentication plug-in

    Securing the MySQL server deployment.
    
    Connecting to MySQL using a blank password.
    
    VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?
    
    Press y|Y for Yes, any other key for No: y
    Copy the code
  2. Select password Rules

    There are three levels of password validation policy:
    
    LOW    Length >= 8
    #The length is greater than or equal to 8
    MEDIUM Length >= 8, numeric, mixed case, and special characters
    #The value contains at least 8 digits, uppercase and lowercase letters, and special characters
    STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file
    #8 or more in length, numbers, upper and lower case letters, special symbols, and dictionary files (carefully selected!)Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 Please set the password for root here. New password: Re-enter new password: (Enter your password again)Copy the code
  3. Create a new password that meets the rules

    Estimated strength of the password: 50 # Do you wish to continue with the password provided? (Press y|Y for Yes, any other key for No) : yCopy the code
  4. Deleting an Anonymous User

    By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother.
    You should remove them before moving into a production environment.
    
    Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
    Success.
    Copy the code
  5. Disabling remote Login

    Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
    
    Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
    Success.
    Copy the code
  6. Delete the test data table

    By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
    
    Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
     - Dropping test database...
    Success.
    
     - Removing privileges on test database...
    Success.
    Copy the code
  7. Done

    Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
    
    Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
    #Whether to reload the permission table
    Success.
    
    All done!
    Copy the code

Your password does not satisfy the current policy requirements.

If you choose a password rule by mistake, you choose 2, which is a combination of numbers, upper and lower case letters, special symbols, and dictionary files. You’ll notice that mysql_secure_installation won’t give you a chance to reset. Manual smile, MMP. There are ways:

SHOW VARIABLES LIKE 'validate_password%';
Copy the code

Run the mysql -u root command to log in to the database.

set global validate_password.policy=0;
set global validate_password.length=4;
#Set the password rule to LOW to use alphanumeric passwords
Copy the code

landing

$ mysql -u root -p
Copy the code

mongodb

Reference: Install MongoDB on Mac OSX platform, install MongoDB database on Mac – Start – Stop – Enable verification – login, [Environment setup: 2] Install AND configure MongoDB on Mac, create, update and delete MongoDB users, and authenticate and log in to MongoDB using user names and passwords

Download and install

$ brew install mongodb/brew/mongodb-community
$ mongod -version
Copy the code

configuration

Start the mongo

1. Create a DBPath

$ sudo mkdir ~/data/db
$ sudo mkdir ~/data/log
Copy the code

2, start,

$ sudo mongod --dbpath ~/data/db --fork --logpath ~/data/log/mongo.log
Copy the code

Note: after Mac OS 10.15.1, the /data/db folder is missing. Object Syntax Max Access Description Impleme nted Read-only File system. Sudo mkdir ~/data/db && sudo mongodb –dbpath ~/data/db

Set authentication and user name and password

$ mongo
Create a super administrator
> db.createUser({ user: "root" , pwd: "123456", roles: ["root"]});
Successfully added user: {
   "user" : "root"."roles" : ["root"]}# try to connect using the user information created above.
> db.auth("root"."123456"1)Create user admin with password 123456.
> db.createUser({ user: "admin".pwd: "123456", roles:["userAdminAnyDatabase"."dbAdminAnyDatabase"."readWriteAnyDatabase"]});
Successfully added user: {
   "user": "admin"."roles": [{"role": "userAdminAnyDatabase"."db": "admin"}}]# try to connect using the user information created above.
> db.auth("admin"."123456"1)Copy the code

Enable login in authentication mode

To enable mongod, specify the –auth parameter to validate mode:

$ sudo mongod --dbpath ~/data/db --fork --logpath ~/data/log/mongo.log --auth
Copy the code

Logon-time authentication

$Mongo 127.0.0.1:27017/admin -u admin -p 123456
#Is equivalent to
$ mongo --port 27017 -u "adminUser" -p "adminPass" --authenticationDatabase "admin"
Copy the code

Verify after Login

$ mongo
> use admin
> ab.auth("admin"."123456")
Copy the code

Exit the mongo

Stop the Mongod service first$ use admin; $ db.shutdownServer(); Then quit Mongo$exit;Copy the code

natapp

Open your Intranet penetration journey, debug wechat sharp tools, please download to the official website

IDE

  • VSCode: Visual Studio Code is an open source Code editor developed by Microsoft that supports Windows, Linux, and macOS operating systems. It supports testing, has built-in Git version control, and also has development environment functions. Examples include code completion, code snippets, and code refactoring.

Set up SSH Key

In the user’s home directory, check whether there is a. SSH directory. If there is, check whether there are id_rsa and id_rsa.pub files in the directory. If not, open a Shell (Git Bash on Windows) and create an SSH Key:

$ ssh-keygen -t rsa -C "[email protected]"
Copy the code

Doodle Intelligence has a large number of high-quality HC, welcome to join, please add my wechat yang_jun_ning, or directly send your resume to [email protected]