Skip to content

Commit 00b01b1

Browse files
committed
Added command aliases
Signed-off-by: alexmerlin <[email protected]>
1 parent 67c1712 commit 00b01b1

File tree

4 files changed

+40
-24
lines changed

4 files changed

+40
-24
lines changed

wsl/os/almalinux9/FAQ.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Frequently Asked Questions
22

3-
43
## How do I switch to a different version of PHP?
54

65
### Switch to PHP 8.3
@@ -19,7 +18,6 @@
1918

2019
sudo dnf module switch-to php:remi-7.4 -y
2120

22-
2321
## How do I switch to a different version of Node.js?
2422

2523
### Switch to Node.js 22.x
@@ -40,31 +38,13 @@
4038
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
4139
sudo dnf install nodejs -y
4240

43-
### Switch to Node.js 16.x
44-
45-
sudo dnf remove nodejs -y
46-
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
47-
sudo dnf install nodejs -y
48-
49-
### Switch to Node.js 14.x
50-
51-
sudo dnf remove nodejs -y
52-
curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash -
53-
sudo dnf install nodejs -y
54-
55-
### Switch to Node.js 12.x
56-
57-
sudo dnf remove nodejs -y
58-
curl -fsSL https://rpm.nodesource.com/setup_12.x | sudo bash -
59-
sudo dnf install nodejs -y
60-
61-
**Note**: Node.js 12.x is no longer actively supported!
62-
6341

6442
## How do I fix common permission issues?
43+
6544
If running your project you encounter some permission issues, follow the below steps.
6645

6746
### Errors:
47+
6848
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/data" is not writable...
6949
7050
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/data/cache" is not writable...
@@ -75,18 +55,39 @@ If running your project you encounter some permission issues, follow the below s
7555

7656
chmod -R 777 data
7757

78-
7958
### Error:
59+
8060
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/public/uploads" is not writable...
8161
8262
**Fix:**
8363

8464
chmod -R 777 public/uploads
8565

86-
8766
### Error:
67+
8868
> PHP Fatal error: Uncaught ErrorException: fopen(/var/www/_example.local_/config/autoload/../../log/error-log-_yyyy-mm-dd.log_): Failed to open stream: Permission denied...
8969
9070
**Fix:**
9171

9272
chmod -R 777 log
73+
74+
## How do I create command aliases?
75+
76+
From either your terminal or file explorer, navigate to your home directory (`/home/<your-username>/`).
77+
78+
Using your preferred text editor, open the file: `.bash_profile` (if it does not exist, creat it first).
79+
80+
Move to the end of the file and enter on a new line:
81+
82+
alias command_alias="command to execute"
83+
84+
where:
85+
86+
- `command_alias` is the name by which you want to call your original command
87+
- `command to execute`: the original command to be executed on alias call
88+
89+
### Example:
90+
91+
alias list_files="ls -Al"
92+
93+
will create an alias called `list_files` that will run the command `ls -Al`.

wsl/os/almalinux9/roles/system/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@
1515
template:
1616
src: wsl.conf.j2
1717
dest: "{{ wsl_config_dest }}"
18+
- name: Copy .bash_profile file
19+
template:
20+
src: bash_profile.j2
21+
dest: "{{ bash_profile_dest }}"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# PHP version switcher commands
2+
alias php74="sudo dnf module switch-to php:remi-7.4 -y"
3+
alias php81="sudo dnf module switch-to php:remi-8.1 -y"
4+
alias php82="sudo dnf module switch-to php:remi-8.2 -y"
5+
alias php83="sudo dnf module switch-to php:remi-8.3 -y"
6+
7+
# Node.js version switcher commands
8+
alias node18="sudo dnf remove nodejs -y && curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - && sudo dnf install nodejs -y"
9+
alias node20="sudo dnf remove nodejs -y && curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash - && sudo dnf install nodejs -y"
10+
alias node22="sudo dnf remove nodejs -y && curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash - && sudo dnf install nodejs -y"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
22
wsl_config_dest: /etc/wsl.conf
3+
bash_profile_dest: "/home/{{ config.system.username }}/.bash_profile"

0 commit comments

Comments
 (0)